Changes in src/libcfa/concurrency/thread [83a071f9:6b0b624]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/thread
r83a071f9 r6b0b624 1 // -*- Mode: CFA -*-2 1 // 3 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 10 9 // Author : Thierry Delisle 11 10 // Created On : Tue Jan 17 12:27:26 2017 12 // Last Modified By : Thierry Delisle13 // Last Modified On : --14 // Update Count : 011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:59:40 2017 13 // Update Count : 3 15 14 // 16 15 17 #ifndef THREADS_H 18 #define THREADS_H 16 #pragma once 19 17 20 #include "assert"18 #include <assert.h> 21 19 #include "invoke.h" 22 20 … … 29 27 // Anything that is resumed is a coroutine. 30 28 trait is_thread(dtype T) { 31 void ^?{}(T &mutex this);32 void main(T &this);33 thread_desc* get_thread(T &this);29 void ^?{}(T* mutex this); 30 void main(T* this); 31 thread_desc* get_thread(T* this); 34 32 }; 35 33 36 #define DECL_THREAD(X) thread_desc* get_thread(X & this) { return &this.__thrd; } void main(X&this)34 #define DECL_THREAD(X) thread_desc* get_thread(X* this) { return &this->__thrd; } void main(X* this) 37 35 38 36 forall( dtype T | is_thread(T) ) 39 static inline coroutine_desc* get_coroutine(T &this) {37 static inline coroutine_desc* get_coroutine(T* this) { 40 38 return &get_thread(this)->cor; 41 39 } 42 40 43 41 forall( dtype T | is_thread(T) ) 44 static inline monitor_desc* get_monitor(T &this) {42 static inline monitor_desc* get_monitor(T * this) { 45 43 return &get_thread(this)->mon; 46 44 } … … 54 52 } 55 53 56 extern volatile thread_local thread_desc *this_thread;54 extern thread_local thread_desc * volatile this_thread; 57 55 58 56 forall( dtype T | is_thread(T) ) 59 void __thrd_start( T &this );57 void __thrd_start( T* this ); 60 58 61 59 //----------------------------------------------------------------------------- 62 60 // Ctors and dtors 63 void ?{}(thread_desc &this);64 void ^?{}(thread_desc &this);61 void ?{}(thread_desc* this); 62 void ^?{}(thread_desc* this); 65 63 66 64 //----------------------------------------------------------------------------- … … 72 70 }; 73 71 74 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T &); } )75 void ?{}( scoped(T) &this );72 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } ) 73 void ?{}( scoped(T)* this ); 76 74 77 forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T &, P); } )78 void ?{}( scoped(T) &this, P params );75 forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } ) 76 void ?{}( scoped(T)* this, P params ); 79 77 80 78 forall( dtype T | sized(T) | is_thread(T) ) 81 void ^?{}( scoped(T) &this );79 void ^?{}( scoped(T)* this ); 82 80 83 81 void yield(); 84 82 void yield( unsigned times ); 85 86 #endif //THREADS_H87 83 88 84 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.