Changeset 8def349 for src/libcfa/concurrency/threads
- Timestamp:
- Jan 24, 2017, 11:45:13 AM (9 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:
- 60819df7
- Parents:
- 63f78f0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/threads
r63f78f0 r8def349 27 27 // Anything that implements this trait can be resumed. 28 28 // Anything that is resumed is a coroutine. 29 trait is_thread(dtype T /*| sized(T)*/) {29 trait is_thread(dtype T | sized(T)) { 30 30 void main(T* this); 31 31 thread_h* get_thread(T* this); 32 /*void ?{}(T*);33 void ^?{}(T*);*/34 32 }; 35 33 36 34 #define DECL_THREAD(X) static inline thread_h* get_thread(X* this) { return &this->t; } void main(X* this); 37 35 38 forall( otype T| is_thread(T) )36 forall( dtype T | sized(T) | is_thread(T) ) 39 37 static inline coroutine* get_coroutine(T* this) { 40 38 return &get_thread(this)->c; … … 55 53 // thread runner 56 54 // Structure that actually start and stop threads 57 forall( otype T| is_thread(T) )55 forall( dtype T | sized(T) | is_thread(T) ) 58 56 struct thread { 59 57 T handle; 60 58 }; 61 59 62 forall( otype T | is_thread(T))60 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } ) 63 61 void ?{}( thread(T)* this ); 64 62 65 forall( otype T, ttype P| is_thread(T) | { void ?{}(T*, P); } )63 forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } ) 66 64 void ?{}( thread(T)* this, P params ); 67 65 68 forall( otype T | is_thread(T))66 forall( dtype T | sized(T) | is_thread(T) | { void ^?{}(T*); } ) 69 67 void ^?{}( thread(T)* this ); 70 68
Note:
See TracChangeset
for help on using the changeset viewer.