Changes in src/libcfa/concurrency/threads [e15df4c:8def349]
- File:
-
- 1 edited
-
src/libcfa/concurrency/threads (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/threads
re15df4c r8def349 29 29 trait is_thread(dtype T | sized(T)) { 30 30 void main(T* this); 31 thread * get_thread(T* this);31 thread_h* get_thread(T* this); 32 32 }; 33 33 34 #define DECL_THREAD(X) static inline thread * get_thread(X* this) { return &this->t; } void main(X* this);34 #define DECL_THREAD(X) static inline thread_h* 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 * this) {41 static inline coroutine* get_coroutine(thread_h* this) { 42 42 return &this->c; 43 43 } 44 44 45 thread * this_thread(void);45 thread_h * this_thread(void); 46 46 47 47 //----------------------------------------------------------------------------- 48 48 // Ctors and dtors 49 void ?{}(thread * this);50 void ^?{}(thread * this);49 void ?{}(thread_h* this); 50 void ^?{}(thread_h* 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 scoped {56 struct thread { 57 57 T handle; 58 58 }; 59 59 60 60 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } ) 61 void ?{}( scoped(T)* this );61 void ?{}( thread(T)* this ); 62 62 63 63 forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } ) 64 void ?{}( scoped(T)* this, P params );64 void ?{}( thread(T)* this, P params ); 65 65 66 66 forall( dtype T | sized(T) | is_thread(T) | { void ^?{}(T*); } ) 67 void ^?{}( scoped(T)* this );67 void ^?{}( thread(T)* this ); 68 68 69 69 void yield();
Note:
See TracChangeset
for help on using the changeset viewer.