Changeset 87d13cd for src/libcfa/concurrency/thread
- Timestamp:
- Mar 21, 2017, 10:07:52 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, 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:
- cb91437
- Parents:
- 829c907 (diff), a53e10a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/thread
r829c907 r87d13cd 22 22 23 23 #include "coroutine" 24 #include "monitor" 24 25 25 26 //----------------------------------------------------------------------------- … … 28 29 // Anything that is resumed is a coroutine. 29 30 trait is_thread(dtype T) { 31 void ^?{}(T* mutex this); 30 32 void main(T* this); 31 33 thread_desc* get_thread(T* this); 32 34 }; 33 35 34 #define DECL_THREAD(X) thread_desc* get_thread(X* this) { return &this-> t; } void main(X* this)36 #define DECL_THREAD(X) thread_desc* get_thread(X* this) { return &this->__thrd; } void main(X* this) 35 37 36 38 forall( dtype T | is_thread(T) ) 37 39 static inline coroutine_desc* get_coroutine(T* this) { 38 return &get_thread(this)->c ;40 return &get_thread(this)->cor; 39 41 } 40 42 41 static inline coroutine_desc* get_coroutine(thread_desc* this) { 42 return &this->c; 43 forall( dtype T | is_thread(T) ) 44 static inline monitor_desc* get_monitor(T * this) { 45 return &get_thread(this)->mon; 46 } 47 48 static inline coroutine_desc* get_coroutine(thread_desc * this) { 49 return &this->cor; 50 } 51 52 static inline monitor_desc* get_monitor(thread_desc * this) { 53 return &this->mon; 43 54 } 44 55 … … 64 75 void ?{}( scoped(T)* this, P params ); 65 76 66 forall( dtype T | sized(T) | is_thread(T) | { void ^?{}(T*); })77 forall( dtype T | sized(T) | is_thread(T) ) 67 78 void ^?{}( scoped(T)* this ); 68 79
Note: See TracChangeset
for help on using the changeset viewer.