Changeset 80d9e49 for src/libcfa/concurrency/invoke.h
- Timestamp:
- Dec 7, 2016, 2:47:53 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 550a338
- Parents:
- a68caae
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/invoke.h
ra68caae r80d9e49 10 10 #define _INVOKE_H_ 11 11 12 #define OFFSET_OF(type, field) ((intptr_t)( &((type*)0)->field)) 13 #define VPTR_OFFSET(type, vptr, field) (OFFSET_OF(type, field) - OFFSET_OF(type, vptr)) 14 15 struct coVtable_t { 16 void (*main)(void*); 17 intptr_t offset_coroutine; 18 intptr_t offset_object; 19 }; 20 21 typedef struct coVtable_t* covptr_t; 22 23 static inline struct coroutine* get_coroutine(covptr_t* vthis) { 24 return (struct coroutine*) ( ((intptr_t)vthis) + ((intptr_t)(*vthis)->offset_coroutine) ); 25 } 26 27 static inline void* get_object(covptr_t* vthis) { 28 return (void*) ( ((intptr_t)vthis) + ((intptr_t)(*vthis)->offset_object) ); 29 } 30 31 struct coStack_t { 12 struct coStack_t { 32 13 unsigned int size; // size of stack 33 14 void *storage; // pointer to stack … … 39 20 }; 40 21 41 enum coroutine_state { Start, Inactive, Active, Halt };22 enum coroutine_state { Start, Inactive, Active, Halt, Primed }; 42 23 43 24 struct coroutine { … … 52 33 }; 53 34 54 void invokeCoroutine(covptr_t* this);55 void startCoroutine(covptr_t* this, void (*invoke)(covptr_t*));56 35 #endif //_INVOKE_H_ 57 36 #else //! defined(__CFA_INVOKE_PRIVATE__)
Note: See TracChangeset
for help on using the changeset viewer.