- File:
-
- 1 edited
-
libcfa/src/concurrency/thread.hfa (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/thread.hfa
rab8c6a6 re235429 22 22 #include "kernel.hfa" 23 23 #include "monitor.hfa" 24 #include "exception.hfa"25 24 26 25 //----------------------------------------------------------------------------- 27 26 // thread trait 28 27 trait is_thread(dtype T) { 29 void ^?{}(T& mutex this);30 void main(T& this);31 $thread* get_thread(T& this);28 void ^?{}(T& mutex this); 29 void main(T& this); 30 $thread* get_thread(T& this); 32 31 }; 33 34 FORALL_DATA_EXCEPTION(ThreadCancelled, (dtype thread_t), (thread_t)) (35 thread_t * the_thread;36 exception_t * the_exception;37 );38 39 forall(dtype T)40 void copy(ThreadCancelled(T) * dst, ThreadCancelled(T) * src);41 42 forall(dtype T)43 const char * msg(ThreadCancelled(T) *);44 32 45 33 // define that satisfies the trait without using the thread keyword … … 77 65 static inline void ?{}($thread & this, const char * const name, struct cluster & cl ) { this{ name, cl, 0p, 65000 }; } 78 66 static inline void ?{}($thread & this, const char * const name, struct cluster & cl, size_t stackSize ) { this{ name, cl, 0p, stackSize }; } 79 80 struct thread_dtor_guard_t {81 monitor_dtor_guard_t mg;82 };83 84 forall( dtype T | is_thread(T) | IS_EXCEPTION(ThreadCancelled, (T)) )85 void ?{}( thread_dtor_guard_t & this, T & thrd, void(*)(ThreadCancelled(T) &) );86 void ^?{}( thread_dtor_guard_t & this );87 67 88 68 //----------------------------------------------------------------------------- … … 128 108 //---------- 129 109 // join 130 forall( dtype T | is_thread(T) | IS_RESUMPTION_EXCEPTION(ThreadCancelled, (T)))110 forall( dtype T | is_thread(T) ) 131 111 T & join( T & this ); 132 112
Note:
See TracChangeset
for help on using the changeset viewer.