Changeset e15df4c for src/libcfa/concurrency/threads
- Timestamp:
- Jan 24, 2017, 4:50:45 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:
- ad56482
- Parents:
- 2cdf6dc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/libcfa/concurrency/threads ¶
r2cdf6dc re15df4c 29 29 trait is_thread(dtype T | sized(T)) { 30 30 void main(T* this); 31 thread _h* get_thread(T* this);31 thread* get_thread(T* this); 32 32 }; 33 33 34 #define DECL_THREAD(X) static inline thread _h* get_thread(X* this) { return &this->t; } void main(X* this);34 #define DECL_THREAD(X) static inline thread* get_thread(X* this) { return &this->t; } void main(X* this); 35 35 36 36 forall( dtype T | sized(T) | is_thread(T) ) … … 39 39 } 40 40 41 static inline coroutine* get_coroutine(thread _h* this) {41 static inline coroutine* get_coroutine(thread* this) { 42 42 return &this->c; 43 43 } 44 44 45 thread _h* this_thread(void);45 thread * this_thread(void); 46 46 47 47 //----------------------------------------------------------------------------- 48 48 // Ctors and dtors 49 void ?{}(thread _h* this);50 void ^?{}(thread _h* this);49 void ?{}(thread* this); 50 void ^?{}(thread* this); 51 51 52 52 //----------------------------------------------------------------------------- … … 54 54 // Structure that actually start and stop threads 55 55 forall( dtype T | sized(T) | is_thread(T) ) 56 struct thread {56 struct scoped { 57 57 T handle; 58 58 }; 59 59 60 60 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } ) 61 void ?{}( thread(T)* this );61 void ?{}( scoped(T)* this ); 62 62 63 63 forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } ) 64 void ?{}( thread(T)* this, P params );64 void ?{}( scoped(T)* this, P params ); 65 65 66 66 forall( dtype T | sized(T) | is_thread(T) | { void ^?{}(T*); } ) 67 void ^?{}( thread(T)* this );67 void ^?{}( scoped(T)* this ); 68 68 69 69 void yield();
Note: See TracChangeset
for help on using the changeset viewer.