Changeset ac2b598 for libcfa/src
- Timestamp:
- Feb 24, 2020, 2:21:03 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 959f6ad
- Parents:
- 0f2c555
- Location:
- libcfa/src/concurrency
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/alarm.cfa
r0f2c555 rac2b598 47 47 //============================================================================================= 48 48 49 void ?{}( alarm_node_t & this, thread_desc* thrd, Time alarm, Duration period ) with( this ) {49 void ?{}( alarm_node_t & this, $thread * thrd, Time alarm, Duration period ) with( this ) { 50 50 this.thrd = thrd; 51 51 this.alarm = alarm; -
libcfa/src/concurrency/alarm.hfa
r0f2c555 rac2b598 23 23 #include "time.hfa" 24 24 25 struct thread_desc;25 struct $thread; 26 26 struct processor; 27 27 … … 43 43 44 44 union { 45 thread_desc* thrd; // thrd who created event45 $thread * thrd; // thrd who created event 46 46 processor * proc; // proc who created event 47 47 }; … … 53 53 typedef alarm_node_t ** __alarm_it_t; 54 54 55 void ?{}( alarm_node_t & this, thread_desc* thrd, Time alarm, Duration period );55 void ?{}( alarm_node_t & this, $thread * thrd, Time alarm, Duration period ); 56 56 void ?{}( alarm_node_t & this, processor * proc, Time alarm, Duration period ); 57 57 void ^?{}( alarm_node_t & this ); -
libcfa/src/concurrency/coroutine.cfa
r0f2c555 rac2b598 37 37 38 38 extern "C" { 39 void _CtxCoroutine_Unwind(struct _Unwind_Exception * storage, struct coroutine_desc*) __attribute__ ((__noreturn__));39 void _CtxCoroutine_Unwind(struct _Unwind_Exception * storage, struct $coroutine *) __attribute__ ((__noreturn__)); 40 40 static void _CtxCoroutine_UnwindCleanup(_Unwind_Reason_Code, struct _Unwind_Exception *) __attribute__ ((__noreturn__)); 41 41 static void _CtxCoroutine_UnwindCleanup(_Unwind_Reason_Code, struct _Unwind_Exception *) { … … 89 89 } 90 90 91 void ?{}( coroutine_desc& this, const char name[], void * storage, size_t storageSize ) with( this ) {91 void ?{}( $coroutine & this, const char name[], void * storage, size_t storageSize ) with( this ) { 92 92 (this.context){0p, 0p}; 93 93 (this.stack){storage, storageSize}; … … 99 99 } 100 100 101 void ^?{}( coroutine_desc& this) {101 void ^?{}($coroutine& this) { 102 102 if(this.state != Halted && this.state != Start && this.state != Primed) { 103 coroutine_desc* src = TL_GET( this_thread )->curr_cor;104 coroutine_desc* dst = &this;103 $coroutine * src = TL_GET( this_thread )->curr_cor; 104 $coroutine * dst = &this; 105 105 106 106 struct _Unwind_Exception storage; … … 115 115 } 116 116 117 CoroutineCtxSwitch( src, dst );117 $ctx_switch( src, dst ); 118 118 } 119 119 } … … 123 123 forall(dtype T | is_coroutine(T)) 124 124 void prime(T& cor) { 125 coroutine_desc* this = get_coroutine(cor);125 $coroutine* this = get_coroutine(cor); 126 126 assert(this->state == Start); 127 127 … … 187 187 // is not inline (We can't inline Cforall in C) 188 188 extern "C" { 189 void __cfactx_cor_leave( struct coroutine_desc* src ) {190 coroutine_desc* starter = src->cancellation != 0 ? src->last : src->starter;189 void __cfactx_cor_leave( struct $coroutine * src ) { 190 $coroutine * starter = src->cancellation != 0 ? src->last : src->starter; 191 191 192 192 src->state = Halted; … … 201 201 src->name, src, starter->name, starter ); 202 202 203 CoroutineCtxSwitch( src, starter );204 } 205 206 struct coroutine_desc* __cfactx_cor_finish(void) {207 struct coroutine_desc* cor = kernelTLS.this_thread->curr_cor;203 $ctx_switch( src, starter ); 204 } 205 206 struct $coroutine * __cfactx_cor_finish(void) { 207 struct $coroutine * cor = kernelTLS.this_thread->curr_cor; 208 208 209 209 if(cor->state == Primed) { -
libcfa/src/concurrency/coroutine.hfa
r0f2c555 rac2b598 25 25 trait is_coroutine(dtype T) { 26 26 void main(T & this); 27 coroutine_desc* get_coroutine(T & this);27 $coroutine * get_coroutine(T & this); 28 28 }; 29 29 30 #define DECL_COROUTINE(X) static inline coroutine_desc* get_coroutine(X& this) { return &this.__cor; } void main(X& this)30 #define DECL_COROUTINE(X) static inline $coroutine* get_coroutine(X& this) { return &this.__cor; } void main(X& this) 31 31 32 32 //----------------------------------------------------------------------------- … … 35 35 // void ^?{}( coStack_t & this ); 36 36 37 void ?{}( coroutine_desc& this, const char name[], void * storage, size_t storageSize );38 void ^?{}( coroutine_desc& this );37 void ?{}( $coroutine & this, const char name[], void * storage, size_t storageSize ); 38 void ^?{}( $coroutine & this ); 39 39 40 static inline void ?{}( coroutine_desc& this) { this{ "Anonymous Coroutine", 0p, 0 }; }41 static inline void ?{}( coroutine_desc& this, size_t stackSize) { this{ "Anonymous Coroutine", 0p, stackSize }; }42 static inline void ?{}( coroutine_desc& this, void * storage, size_t storageSize ) { this{ "Anonymous Coroutine", storage, storageSize }; }43 static inline void ?{}( coroutine_desc& this, const char name[]) { this{ name, 0p, 0 }; }44 static inline void ?{}( coroutine_desc& this, const char name[], size_t stackSize ) { this{ name, 0p, stackSize }; }40 static inline void ?{}( $coroutine & this) { this{ "Anonymous Coroutine", 0p, 0 }; } 41 static inline void ?{}( $coroutine & this, size_t stackSize) { this{ "Anonymous Coroutine", 0p, stackSize }; } 42 static inline void ?{}( $coroutine & this, void * storage, size_t storageSize ) { this{ "Anonymous Coroutine", storage, storageSize }; } 43 static inline void ?{}( $coroutine & this, const char name[]) { this{ name, 0p, 0 }; } 44 static inline void ?{}( $coroutine & this, const char name[], size_t stackSize ) { this{ name, 0p, stackSize }; } 45 45 46 46 //----------------------------------------------------------------------------- … … 54 54 void prime(T & cor); 55 55 56 static inline struct coroutine_desc* active_coroutine() { return TL_GET( this_thread )->curr_cor; }56 static inline struct $coroutine * active_coroutine() { return TL_GET( this_thread )->curr_cor; } 57 57 58 58 //----------------------------------------------------------------------------- … … 64 64 65 65 forall(dtype T) 66 void __cfactx_start(void (*main)(T &), struct coroutine_desc* cor, T & this, void (*invoke)(void (*main)(void *), void *));66 void __cfactx_start(void (*main)(T &), struct $coroutine * cor, T & this, void (*invoke)(void (*main)(void *), void *)); 67 67 68 extern void __cfactx_coroutine_unwind(struct _Unwind_Exception * storage, struct coroutine_desc*) __attribute__ ((__noreturn__));68 extern void __cfactx_coroutine_unwind(struct _Unwind_Exception * storage, struct $coroutine *) __attribute__ ((__noreturn__)); 69 69 70 70 extern void __cfactx_switch( struct __stack_context_t * from, struct __stack_context_t * to ) asm ("__cfactx_switch"); … … 73 73 // Private wrappers for context switch and stack creation 74 74 // Wrapper for co 75 static inline void CoroutineCtxSwitch( coroutine_desc * src, coroutine_desc* dst ) __attribute__((nonnull (1, 2))) {75 static inline void $ctx_switch( $coroutine * src, $coroutine * dst ) __attribute__((nonnull (1, 2))) { 76 76 // set state of current coroutine to inactive 77 77 src->state = src->state == Halted ? Halted : Inactive; … … 102 102 // will also migrate which means this value will 103 103 // stay in syn with the TLS 104 coroutine_desc* src = TL_GET( this_thread )->curr_cor;104 $coroutine * src = TL_GET( this_thread )->curr_cor; 105 105 106 106 assertf( src->last != 0, … … 113 113 src->name, src, src->last->name, src->last ); 114 114 115 CoroutineCtxSwitch( src, src->last );115 $ctx_switch( src, src->last ); 116 116 } 117 117 … … 124 124 // will also migrate which means this value will 125 125 // stay in syn with the TLS 126 coroutine_desc* src = TL_GET( this_thread )->curr_cor;127 coroutine_desc* dst = get_coroutine(cor);126 $coroutine * src = TL_GET( this_thread )->curr_cor; 127 $coroutine * dst = get_coroutine(cor); 128 128 129 129 if( unlikely(dst->context.SP == 0p) ) { … … 147 147 148 148 // always done for performance testing 149 CoroutineCtxSwitch( src, dst );149 $ctx_switch( src, dst ); 150 150 151 151 return cor; 152 152 } 153 153 154 static inline void resume( coroutine_desc* dst ) __attribute__((nonnull (1))) {154 static inline void resume( $coroutine * dst ) __attribute__((nonnull (1))) { 155 155 // optimization : read TLS once and reuse it 156 156 // Safety note: this is preemption safe since if … … 158 158 // will also migrate which means this value will 159 159 // stay in syn with the TLS 160 coroutine_desc* src = TL_GET( this_thread )->curr_cor;160 $coroutine * src = TL_GET( this_thread )->curr_cor; 161 161 162 162 // not resuming self ? … … 172 172 173 173 // always done for performance testing 174 CoroutineCtxSwitch( src, dst );174 $ctx_switch( src, dst ); 175 175 } 176 176 -
libcfa/src/concurrency/invoke.c
r0f2c555 rac2b598 29 29 // Called from the kernel when starting a coroutine or task so must switch back to user mode. 30 30 31 extern struct coroutine_desc* __cfactx_cor_finish(void);32 extern void __cfactx_cor_leave ( struct coroutine_desc* );31 extern struct $coroutine * __cfactx_cor_finish(void); 32 extern void __cfactx_cor_leave ( struct $coroutine * ); 33 33 extern void __cfactx_thrd_leave(); 34 34 … … 41 41 ) { 42 42 // Finish setting up the coroutine by setting its state 43 struct coroutine_desc* cor = __cfactx_cor_finish();43 struct $coroutine * cor = __cfactx_cor_finish(); 44 44 45 45 // Call the main of the coroutine … … 70 70 } 71 71 72 void __cfactx_coroutine_unwind(struct _Unwind_Exception * storage, struct coroutine_desc* cor) __attribute__ ((__noreturn__));73 void __cfactx_coroutine_unwind(struct _Unwind_Exception * storage, struct coroutine_desc* cor) {72 void __cfactx_coroutine_unwind(struct _Unwind_Exception * storage, struct $coroutine * cor) __attribute__ ((__noreturn__)); 73 void __cfactx_coroutine_unwind(struct _Unwind_Exception * storage, struct $coroutine * cor) { 74 74 _Unwind_Reason_Code ret = _Unwind_ForcedUnwind( storage, __cfactx_coroutine_unwindstop, cor ); 75 75 printf("UNWIND ERROR %d after force unwind\n", ret); … … 100 100 void __cfactx_start( 101 101 void (*main)(void *), 102 struct coroutine_desc* cor,102 struct $coroutine * cor, 103 103 void *this, 104 104 void (*invoke)(void *) -
libcfa/src/concurrency/invoke.h
r0f2c555 rac2b598 47 47 extern "Cforall" { 48 48 extern __attribute__((aligned(128))) thread_local struct KernelThreadData { 49 struct thread_desc* volatile this_thread;49 struct $thread * volatile this_thread; 50 50 struct processor * volatile this_processor; 51 51 … … 95 95 enum __Preemption_Reason { __NO_PREEMPTION, __ALARM_PREEMPTION, __POLL_PREEMPTION, __MANUAL_PREEMPTION }; 96 96 97 struct coroutine_desc{97 struct $coroutine { 98 98 // context that is switch during a __cfactx_switch 99 99 struct __stack_context_t context; … … 109 109 110 110 // first coroutine to resume this one 111 struct coroutine_desc* starter;111 struct $coroutine * starter; 112 112 113 113 // last coroutine to resume this one 114 struct coroutine_desc* last;114 struct $coroutine * last; 115 115 116 116 // If non-null stack must be unwound with this exception … … 128 128 }; 129 129 130 struct monitor_desc{130 struct $monitor { 131 131 // spinlock to protect internal data 132 132 struct __spinlock_t lock; 133 133 134 134 // current owner of the monitor 135 struct thread_desc* owner;135 struct $thread * owner; 136 136 137 137 // queue of threads that are blocked waiting for the monitor 138 __queue_t(struct thread_desc) entry_queue;138 __queue_t(struct $thread) entry_queue; 139 139 140 140 // stack of conditions to run next once we exit the monitor … … 153 153 struct __monitor_group_t { 154 154 // currently held monitors 155 __cfa_anonymous_object( __small_array_t( monitor_desc*) );155 __cfa_anonymous_object( __small_array_t($monitor*) ); 156 156 157 157 // last function that acquired monitors … … 159 159 }; 160 160 161 struct thread_desc{161 struct $thread { 162 162 // Core threading fields 163 163 // context that is switch during a __cfactx_switch … … 171 171 172 172 // coroutine body used to store context 173 struct coroutine_descself_cor;173 struct $coroutine self_cor; 174 174 175 175 // current active context 176 struct coroutine_desc* curr_cor;176 struct $coroutine * curr_cor; 177 177 178 178 // monitor body used for mutual exclusion 179 struct monitor_descself_mon;179 struct $monitor self_mon; 180 180 181 181 // pointer to monitor with sufficient lifetime for current monitors 182 struct monitor_desc* self_mon_p;182 struct $monitor * self_mon_p; 183 183 184 184 // pointer to the cluster on which the thread is running … … 190 190 // Link lists fields 191 191 // instrusive link field for threads 192 struct thread_desc* next;192 struct $thread * next; 193 193 194 194 struct { 195 struct thread_desc* next;196 struct thread_desc* prev;195 struct $thread * next; 196 struct $thread * prev; 197 197 } node; 198 198 }; … … 200 200 #ifdef __cforall 201 201 extern "Cforall" { 202 static inline thread_desc *& get_next( thread_desc& this ) __attribute__((const)) {202 static inline $thread *& get_next( $thread & this ) __attribute__((const)) { 203 203 return this.next; 204 204 } 205 205 206 static inline [ thread_desc *&, thread_desc *& ] __get( thread_desc& this ) __attribute__((const)) {206 static inline [$thread *&, $thread *& ] __get( $thread & this ) __attribute__((const)) { 207 207 return this.node.[next, prev]; 208 208 } … … 214 214 } 215 215 216 static inline void ?{}(__monitor_group_t & this, struct monitor_desc** data, __lock_size_t size, fptr_t func) {216 static inline void ?{}(__monitor_group_t & this, struct $monitor ** data, __lock_size_t size, fptr_t func) { 217 217 (this.data){data}; 218 218 (this.size){size}; -
libcfa/src/concurrency/kernel.cfa
r0f2c555 rac2b598 117 117 KERNEL_STORAGE(cluster, mainCluster); 118 118 KERNEL_STORAGE(processor, mainProcessor); 119 KERNEL_STORAGE( thread_desc, mainThread);119 KERNEL_STORAGE($thread, mainThread); 120 120 KERNEL_STORAGE(__stack_t, mainThreadCtx); 121 121 122 122 cluster * mainCluster; 123 123 processor * mainProcessor; 124 thread_desc* mainThread;124 $thread * mainThread; 125 125 126 126 extern "C" { … … 164 164 // Main thread construction 165 165 166 void ?{}( coroutine_desc& this, current_stack_info_t * info) with( this ) {166 void ?{}( $coroutine & this, current_stack_info_t * info) with( this ) { 167 167 stack.storage = info->storage; 168 168 with(*stack.storage) { … … 179 179 } 180 180 181 void ?{}( thread_desc& this, current_stack_info_t * info) with( this ) {181 void ?{}( $thread & this, current_stack_info_t * info) with( this ) { 182 182 state = Start; 183 183 self_cor{ info }; … … 264 264 // Kernel Scheduling logic 265 265 //============================================================================================= 266 static thread_desc* __next_thread(cluster * this);267 static void __run_thread(processor * this, thread_desc* dst);266 static $thread * __next_thread(cluster * this); 267 static void __run_thread(processor * this, $thread * dst); 268 268 static void __halt(processor * this); 269 269 … … 287 287 __cfaabi_dbg_print_safe("Kernel : core %p started\n", this); 288 288 289 thread_desc* readyThread = 0p;289 $thread * readyThread = 0p; 290 290 for( unsigned int spin_count = 0; ! __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST); spin_count++ ) { 291 291 readyThread = __next_thread( this->cltr ); … … 323 323 // runThread runs a thread by context switching 324 324 // from the processor coroutine to the target thread 325 static void __run_thread(processor * this, thread_desc* thrd_dst) {326 coroutine_desc* proc_cor = get_coroutine(this->runner);325 static void __run_thread(processor * this, $thread * thrd_dst) { 326 $coroutine * proc_cor = get_coroutine(this->runner); 327 327 328 328 // Update global state … … 400 400 void returnToKernel() { 401 401 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 402 coroutine_desc* proc_cor = get_coroutine(kernelTLS.this_processor->runner);403 thread_desc* thrd_src = kernelTLS.this_thread;402 $coroutine * proc_cor = get_coroutine(kernelTLS.this_processor->runner); 403 $thread * thrd_src = kernelTLS.this_thread; 404 404 405 405 // Run the thread on this processor … … 495 495 // KERNEL_ONLY 496 496 static void __kernel_first_resume( processor * this ) { 497 thread_desc* src = mainThread;498 coroutine_desc* dst = get_coroutine(this->runner);497 $thread * src = mainThread; 498 $coroutine * dst = get_coroutine(this->runner); 499 499 500 500 verify( ! kernelTLS.preemption_state.enabled ); … … 527 527 // KERNEL_ONLY 528 528 static void __kernel_last_resume( processor * this ) { 529 coroutine_desc* src = &mainThread->self_cor;530 coroutine_desc* dst = get_coroutine(this->runner);529 $coroutine * src = &mainThread->self_cor; 530 $coroutine * dst = get_coroutine(this->runner); 531 531 532 532 verify( ! kernelTLS.preemption_state.enabled ); … … 541 541 // Scheduler routines 542 542 // KERNEL ONLY 543 void __schedule_thread( thread_desc* thrd ) with( *thrd->curr_cluster ) {543 void __schedule_thread( $thread * thrd ) with( *thrd->curr_cluster ) { 544 544 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 545 545 /* paranoid */ #if defined( __CFA_WITH_VERIFY__ ) … … 571 571 572 572 // KERNEL ONLY 573 static thread_desc* __next_thread(cluster * this) with( *this ) {573 static $thread * __next_thread(cluster * this) with( *this ) { 574 574 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 575 575 576 576 lock( ready_queue_lock __cfaabi_dbg_ctx2 ); 577 thread_desc* head = pop_head( ready_queue );577 $thread * head = pop_head( ready_queue ); 578 578 unlock( ready_queue_lock ); 579 579 … … 582 582 } 583 583 584 void unpark( thread_desc* thrd ) {584 void unpark( $thread * thrd ) { 585 585 if( !thrd ) return; 586 586 … … 639 639 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 640 640 641 thread_desc* thrd = kernelTLS.this_thread;641 $thread * thrd = kernelTLS.this_thread; 642 642 /* paranoid */ verify(thrd->state == Active || thrd->state == Rerun); 643 643 … … 683 683 // SKULLDUGGERY: the mainThread steals the process main thread 684 684 // which will then be scheduled by the mainProcessor normally 685 mainThread = ( thread_desc*)&storage_mainThread;685 mainThread = ($thread *)&storage_mainThread; 686 686 current_stack_info_t info; 687 687 info.storage = (__stack_t*)&storage_mainThreadCtx; … … 835 835 836 836 void kernel_abort_msg( void * kernel_data, char * abort_text, int abort_text_size ) { 837 thread_desc* thrd = kernel_data;837 $thread * thrd = kernel_data; 838 838 839 839 if(thrd) { … … 900 900 901 901 void V(semaphore & this) with( this ) { 902 thread_desc* thrd = 0p;902 $thread * thrd = 0p; 903 903 lock( lock __cfaabi_dbg_ctx2 ); 904 904 count += 1; … … 928 928 } 929 929 930 void doregister( cluster * cltr, thread_desc& thrd ) {930 void doregister( cluster * cltr, $thread & thrd ) { 931 931 lock (cltr->thread_list_lock __cfaabi_dbg_ctx2); 932 932 cltr->nthreads += 1; … … 935 935 } 936 936 937 void unregister( cluster * cltr, thread_desc& thrd ) {937 void unregister( cluster * cltr, $thread & thrd ) { 938 938 lock (cltr->thread_list_lock __cfaabi_dbg_ctx2); 939 939 remove(cltr->threads, thrd ); -
libcfa/src/concurrency/kernel.hfa
r0f2c555 rac2b598 32 32 __spinlock_t lock; 33 33 int count; 34 __queue_t( thread_desc) waiting;34 __queue_t($thread) waiting; 35 35 }; 36 36 … … 67 67 // RunThread data 68 68 // Action to do after a thread is ran 69 thread_desc* destroyer;69 $thread * destroyer; 70 70 71 71 // Preemption data … … 117 117 118 118 // Ready queue for threads 119 __queue_t( thread_desc) ready_queue;119 __queue_t($thread) ready_queue; 120 120 121 121 // Name of the cluster … … 133 133 // List of threads 134 134 __spinlock_t thread_list_lock; 135 __dllist_t(struct thread_desc) threads;135 __dllist_t(struct $thread) threads; 136 136 unsigned int nthreads; 137 137 -
libcfa/src/concurrency/kernel_private.hfa
r0f2c555 rac2b598 31 31 } 32 32 33 void __schedule_thread( thread_desc* ) __attribute__((nonnull (1)));33 void __schedule_thread( $thread * ) __attribute__((nonnull (1))); 34 34 35 35 //Block current thread and release/wake-up the following resources … … 74 74 } 75 75 76 extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst);77 78 76 __cfaabi_dbg_debug_do( 79 extern void __cfaabi_dbg_thread_register ( thread_desc* thrd );80 extern void __cfaabi_dbg_thread_unregister( thread_desc* thrd );77 extern void __cfaabi_dbg_thread_register ( $thread * thrd ); 78 extern void __cfaabi_dbg_thread_unregister( $thread * thrd ); 81 79 ) 82 80 … … 96 94 void unregister( struct cluster & cltr ); 97 95 98 void doregister( struct cluster * cltr, struct thread_desc& thrd );99 void unregister( struct cluster * cltr, struct thread_desc& thrd );96 void doregister( struct cluster * cltr, struct $thread & thrd ); 97 void unregister( struct cluster * cltr, struct $thread & thrd ); 100 98 101 99 void doregister( struct cluster * cltr, struct processor * proc ); -
libcfa/src/concurrency/monitor.cfa
r0f2c555 rac2b598 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // monitor_desc.c --7 // $monitor.c -- 8 8 // 9 9 // Author : Thierry Delisle … … 27 27 //----------------------------------------------------------------------------- 28 28 // Forward declarations 29 static inline void __set_owner ( monitor_desc * this, thread_desc* owner );30 static inline void __set_owner ( monitor_desc * storage [], __lock_size_t count, thread_desc* owner );31 static inline void set_mask ( monitor_desc* storage [], __lock_size_t count, const __waitfor_mask_t & mask );32 static inline void reset_mask( monitor_desc* this );33 34 static inline thread_desc * next_thread( monitor_desc* this );35 static inline bool is_accepted( monitor_desc* this, const __monitor_group_t & monitors );29 static inline void __set_owner ( $monitor * this, $thread * owner ); 30 static inline void __set_owner ( $monitor * storage [], __lock_size_t count, $thread * owner ); 31 static inline void set_mask ( $monitor * storage [], __lock_size_t count, const __waitfor_mask_t & mask ); 32 static inline void reset_mask( $monitor * this ); 33 34 static inline $thread * next_thread( $monitor * this ); 35 static inline bool is_accepted( $monitor * this, const __monitor_group_t & monitors ); 36 36 37 37 static inline void lock_all ( __spinlock_t * locks [], __lock_size_t count ); 38 static inline void lock_all ( monitor_desc* source [], __spinlock_t * /*out*/ locks [], __lock_size_t count );38 static inline void lock_all ( $monitor * source [], __spinlock_t * /*out*/ locks [], __lock_size_t count ); 39 39 static inline void unlock_all( __spinlock_t * locks [], __lock_size_t count ); 40 static inline void unlock_all( monitor_desc* locks [], __lock_size_t count );41 42 static inline void save ( monitor_desc* ctx [], __lock_size_t count, __spinlock_t * locks [], unsigned int /*out*/ recursions [], __waitfor_mask_t /*out*/ masks [] );43 static inline void restore( monitor_desc* ctx [], __lock_size_t count, __spinlock_t * locks [], unsigned int /*in */ recursions [], __waitfor_mask_t /*in */ masks [] );44 45 static inline void init ( __lock_size_t count, monitor_desc* monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] );46 static inline void init_push( __lock_size_t count, monitor_desc* monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] );47 48 static inline thread_desc* check_condition ( __condition_criterion_t * );40 static inline void unlock_all( $monitor * locks [], __lock_size_t count ); 41 42 static inline void save ( $monitor * ctx [], __lock_size_t count, __spinlock_t * locks [], unsigned int /*out*/ recursions [], __waitfor_mask_t /*out*/ masks [] ); 43 static inline void restore( $monitor * ctx [], __lock_size_t count, __spinlock_t * locks [], unsigned int /*in */ recursions [], __waitfor_mask_t /*in */ masks [] ); 44 45 static inline void init ( __lock_size_t count, $monitor * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] ); 46 static inline void init_push( __lock_size_t count, $monitor * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] ); 47 48 static inline $thread * check_condition ( __condition_criterion_t * ); 49 49 static inline void brand_condition ( condition & ); 50 static inline [ thread_desc *, int] search_entry_queue( const __waitfor_mask_t &, monitor_desc* monitors [], __lock_size_t count );50 static inline [$thread *, int] search_entry_queue( const __waitfor_mask_t &, $monitor * monitors [], __lock_size_t count ); 51 51 52 52 forall(dtype T | sized( T )) 53 53 static inline __lock_size_t insert_unique( T * array [], __lock_size_t & size, T * val ); 54 54 static inline __lock_size_t count_max ( const __waitfor_mask_t & mask ); 55 static inline __lock_size_t aggregate ( monitor_desc* storage [], const __waitfor_mask_t & mask );55 static inline __lock_size_t aggregate ( $monitor * storage [], const __waitfor_mask_t & mask ); 56 56 57 57 //----------------------------------------------------------------------------- … … 68 68 69 69 #define monitor_ctx( mons, cnt ) /* Define that create the necessary struct for internal/external scheduling operations */ \ 70 monitor_desc** monitors = mons; /* Save the targeted monitors */ \70 $monitor ** monitors = mons; /* Save the targeted monitors */ \ 71 71 __lock_size_t count = cnt; /* Save the count to a local variable */ \ 72 72 unsigned int recursions[ count ]; /* Save the current recursion levels to restore them later */ \ … … 81 81 // Enter/Leave routines 82 82 // Enter single monitor 83 static void __enter( monitor_desc* this, const __monitor_group_t & group ) {83 static void __enter( $monitor * this, const __monitor_group_t & group ) { 84 84 // Lock the monitor spinlock 85 85 lock( this->lock __cfaabi_dbg_ctx2 ); 86 86 // Interrupts disable inside critical section 87 thread_desc* thrd = kernelTLS.this_thread;87 $thread * thrd = kernelTLS.this_thread; 88 88 89 89 __cfaabi_dbg_print_safe( "Kernel : %10p Entering mon %p (%p)\n", thrd, this, this->owner); … … 137 137 } 138 138 139 static void __dtor_enter( monitor_desc* this, fptr_t func ) {139 static void __dtor_enter( $monitor * this, fptr_t func ) { 140 140 // Lock the monitor spinlock 141 141 lock( this->lock __cfaabi_dbg_ctx2 ); 142 142 // Interrupts disable inside critical section 143 thread_desc* thrd = kernelTLS.this_thread;143 $thread * thrd = kernelTLS.this_thread; 144 144 145 145 __cfaabi_dbg_print_safe( "Kernel : %10p Entering dtor for mon %p (%p)\n", thrd, this, this->owner); … … 164 164 165 165 __lock_size_t count = 1; 166 monitor_desc** monitors = &this;166 $monitor ** monitors = &this; 167 167 __monitor_group_t group = { &this, 1, func }; 168 168 if( is_accepted( this, group) ) { … … 216 216 217 217 // Leave single monitor 218 void __leave( monitor_desc* this ) {218 void __leave( $monitor * this ) { 219 219 // Lock the monitor spinlock 220 220 lock( this->lock __cfaabi_dbg_ctx2 ); … … 236 236 237 237 // Get the next thread, will be null on low contention monitor 238 thread_desc* new_owner = next_thread( this );238 $thread * new_owner = next_thread( this ); 239 239 240 240 // Check the new owner is consistent with who we wake-up … … 251 251 252 252 // Leave single monitor for the last time 253 void __dtor_leave( monitor_desc* this ) {253 void __dtor_leave( $monitor * this ) { 254 254 __cfaabi_dbg_debug_do( 255 255 if( TL_GET( this_thread ) != this->owner ) { … … 267 267 // Should never return 268 268 void __cfactx_thrd_leave() { 269 thread_desc* thrd = TL_GET( this_thread );270 monitor_desc* this = &thrd->self_mon;269 $thread * thrd = TL_GET( this_thread ); 270 $monitor * this = &thrd->self_mon; 271 271 272 272 // Lock the monitor now … … 287 287 288 288 // Fetch the next thread, can be null 289 thread_desc* new_owner = next_thread( this );289 $thread * new_owner = next_thread( this ); 290 290 291 291 // Release the monitor lock … … 317 317 // Leave multiple monitor 318 318 // relies on the monitor array being sorted 319 static inline void leave( monitor_desc* monitors [], __lock_size_t count) {319 static inline void leave($monitor * monitors [], __lock_size_t count) { 320 320 for( __lock_size_t i = count - 1; i >= 0; i--) { 321 321 __leave( monitors[i] ); … … 325 325 // Ctor for monitor guard 326 326 // Sorts monitors before entering 327 void ?{}( monitor_guard_t & this, monitor_desc* m [], __lock_size_t count, fptr_t func ) {328 thread_desc* thrd = TL_GET( this_thread );327 void ?{}( monitor_guard_t & this, $monitor * m [], __lock_size_t count, fptr_t func ) { 328 $thread * thrd = TL_GET( this_thread ); 329 329 330 330 // Store current array … … 366 366 // Ctor for monitor guard 367 367 // Sorts monitors before entering 368 void ?{}( monitor_dtor_guard_t & this, monitor_desc* m [], fptr_t func ) {368 void ?{}( monitor_dtor_guard_t & this, $monitor * m [], fptr_t func ) { 369 369 // optimization 370 thread_desc* thrd = TL_GET( this_thread );370 $thread * thrd = TL_GET( this_thread ); 371 371 372 372 // Store current array … … 393 393 //----------------------------------------------------------------------------- 394 394 // Internal scheduling types 395 void ?{}(__condition_node_t & this, thread_desc* waiting_thread, __lock_size_t count, uintptr_t user_info ) {395 void ?{}(__condition_node_t & this, $thread * waiting_thread, __lock_size_t count, uintptr_t user_info ) { 396 396 this.waiting_thread = waiting_thread; 397 397 this.count = count; … … 407 407 } 408 408 409 void ?{}(__condition_criterion_t & this, monitor_desc* target, __condition_node_t & owner ) {409 void ?{}(__condition_criterion_t & this, $monitor * target, __condition_node_t & owner ) { 410 410 this.ready = false; 411 411 this.target = target; … … 441 441 // Find the next thread(s) to run 442 442 __lock_size_t thread_count = 0; 443 thread_desc* threads[ count ];443 $thread * threads[ count ]; 444 444 __builtin_memset( threads, 0, sizeof( threads ) ); 445 445 … … 449 449 // Remove any duplicate threads 450 450 for( __lock_size_t i = 0; i < count; i++) { 451 thread_desc* new_owner = next_thread( monitors[i] );451 $thread * new_owner = next_thread( monitors[i] ); 452 452 insert_unique( threads, thread_count, new_owner ); 453 453 } … … 479 479 //Some more checking in debug 480 480 __cfaabi_dbg_debug_do( 481 thread_desc* this_thrd = TL_GET( this_thread );481 $thread * this_thrd = TL_GET( this_thread ); 482 482 if ( this.monitor_count != this_thrd->monitors.size ) { 483 483 abort( "Signal on condition %p made with different number of monitor(s), expected %zi got %zi", &this, this.monitor_count, this_thrd->monitors.size ); … … 533 533 534 534 //Find the thread to run 535 thread_desc* signallee = pop_head( this.blocked )->waiting_thread;535 $thread * signallee = pop_head( this.blocked )->waiting_thread; 536 536 /* paranoid */ verify( signallee->next == 0p ); 537 537 __set_owner( monitors, count, signallee ); … … 587 587 // Create one! 588 588 __lock_size_t max = count_max( mask ); 589 monitor_desc* mon_storage[max];589 $monitor * mon_storage[max]; 590 590 __builtin_memset( mon_storage, 0, sizeof( mon_storage ) ); 591 591 __lock_size_t actual_count = aggregate( mon_storage, mask ); … … 605 605 { 606 606 // Check if the entry queue 607 thread_desc* next; int index;607 $thread * next; int index; 608 608 [next, index] = search_entry_queue( mask, monitors, count ); 609 609 … … 615 615 verifyf( accepted.size == 1, "ERROR: Accepted dtor has more than 1 mutex parameter." ); 616 616 617 monitor_desc* mon2dtor = accepted[0];617 $monitor * mon2dtor = accepted[0]; 618 618 verifyf( mon2dtor->dtor_node, "ERROR: Accepted monitor has no dtor_node." ); 619 619 … … 709 709 // Utilities 710 710 711 static inline void __set_owner( monitor_desc * this, thread_desc* owner ) {711 static inline void __set_owner( $monitor * this, $thread * owner ) { 712 712 /* paranoid */ verify( this->lock.lock ); 713 713 … … 719 719 } 720 720 721 static inline void __set_owner( monitor_desc * monitors [], __lock_size_t count, thread_desc* owner ) {721 static inline void __set_owner( $monitor * monitors [], __lock_size_t count, $thread * owner ) { 722 722 /* paranoid */ verify ( monitors[0]->lock.lock ); 723 723 /* paranoid */ verifyf( monitors[0]->owner == kernelTLS.this_thread, "Expected owner to be %p, got %p (r: %i, m: %p)", kernelTLS.this_thread, monitors[0]->owner, monitors[0]->recursion, monitors[0] ); … … 732 732 } 733 733 734 static inline void set_mask( monitor_desc* storage [], __lock_size_t count, const __waitfor_mask_t & mask ) {734 static inline void set_mask( $monitor * storage [], __lock_size_t count, const __waitfor_mask_t & mask ) { 735 735 for( __lock_size_t i = 0; i < count; i++) { 736 736 storage[i]->mask = mask; … … 738 738 } 739 739 740 static inline void reset_mask( monitor_desc* this ) {740 static inline void reset_mask( $monitor * this ) { 741 741 this->mask.accepted = 0p; 742 742 this->mask.data = 0p; … … 744 744 } 745 745 746 static inline thread_desc * next_thread( monitor_desc* this ) {746 static inline $thread * next_thread( $monitor * this ) { 747 747 //Check the signaller stack 748 748 __cfaabi_dbg_print_safe( "Kernel : mon %p AS-stack top %p\n", this, this->signal_stack.top); … … 760 760 // No signaller thread 761 761 // Get the next thread in the entry_queue 762 thread_desc* new_owner = pop_head( this->entry_queue );762 $thread * new_owner = pop_head( this->entry_queue ); 763 763 /* paranoid */ verifyf( !this->owner || kernelTLS.this_thread == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", kernelTLS.this_thread, this->owner, this->recursion, this ); 764 764 /* paranoid */ verify( !new_owner || new_owner->next == 0p ); … … 768 768 } 769 769 770 static inline bool is_accepted( monitor_desc* this, const __monitor_group_t & group ) {770 static inline bool is_accepted( $monitor * this, const __monitor_group_t & group ) { 771 771 __acceptable_t * it = this->mask.data; // Optim 772 772 __lock_size_t count = this->mask.size; … … 790 790 } 791 791 792 static inline void init( __lock_size_t count, monitor_desc* monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] ) {792 static inline void init( __lock_size_t count, $monitor * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] ) { 793 793 for( __lock_size_t i = 0; i < count; i++) { 794 794 (criteria[i]){ monitors[i], waiter }; … … 798 798 } 799 799 800 static inline void init_push( __lock_size_t count, monitor_desc* monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] ) {800 static inline void init_push( __lock_size_t count, $monitor * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] ) { 801 801 for( __lock_size_t i = 0; i < count; i++) { 802 802 (criteria[i]){ monitors[i], waiter }; … … 814 814 } 815 815 816 static inline void lock_all( monitor_desc* source [], __spinlock_t * /*out*/ locks [], __lock_size_t count ) {816 static inline void lock_all( $monitor * source [], __spinlock_t * /*out*/ locks [], __lock_size_t count ) { 817 817 for( __lock_size_t i = 0; i < count; i++ ) { 818 818 __spinlock_t * l = &source[i]->lock; … … 828 828 } 829 829 830 static inline void unlock_all( monitor_desc* locks [], __lock_size_t count ) {830 static inline void unlock_all( $monitor * locks [], __lock_size_t count ) { 831 831 for( __lock_size_t i = 0; i < count; i++ ) { 832 832 unlock( locks[i]->lock ); … … 835 835 836 836 static inline void save( 837 monitor_desc* ctx [],837 $monitor * ctx [], 838 838 __lock_size_t count, 839 839 __attribute((unused)) __spinlock_t * locks [], … … 848 848 849 849 static inline void restore( 850 monitor_desc* ctx [],850 $monitor * ctx [], 851 851 __lock_size_t count, 852 852 __spinlock_t * locks [], … … 866 866 // 2 - Checks if all the monitors are ready to run 867 867 // if so return the thread to run 868 static inline thread_desc* check_condition( __condition_criterion_t * target ) {868 static inline $thread * check_condition( __condition_criterion_t * target ) { 869 869 __condition_node_t * node = target->owner; 870 870 unsigned short count = node->count; … … 889 889 890 890 static inline void brand_condition( condition & this ) { 891 thread_desc* thrd = TL_GET( this_thread );891 $thread * thrd = TL_GET( this_thread ); 892 892 if( !this.monitors ) { 893 893 // __cfaabi_dbg_print_safe( "Branding\n" ); … … 895 895 this.monitor_count = thrd->monitors.size; 896 896 897 this.monitors = ( monitor_desc**)malloc( this.monitor_count * sizeof( *this.monitors ) );897 this.monitors = ($monitor **)malloc( this.monitor_count * sizeof( *this.monitors ) ); 898 898 for( int i = 0; i < this.monitor_count; i++ ) { 899 899 this.monitors[i] = thrd->monitors[i]; … … 902 902 } 903 903 904 static inline [ thread_desc *, int] search_entry_queue( const __waitfor_mask_t & mask, monitor_desc* monitors [], __lock_size_t count ) {905 906 __queue_t( thread_desc) & entry_queue = monitors[0]->entry_queue;904 static inline [$thread *, int] search_entry_queue( const __waitfor_mask_t & mask, $monitor * monitors [], __lock_size_t count ) { 905 906 __queue_t($thread) & entry_queue = monitors[0]->entry_queue; 907 907 908 908 // For each thread in the entry-queue 909 for( thread_desc** thrd_it = &entry_queue.head;909 for( $thread ** thrd_it = &entry_queue.head; 910 910 *thrd_it != 1p; 911 911 thrd_it = &(*thrd_it)->next … … 951 951 } 952 952 953 static inline __lock_size_t aggregate( monitor_desc* storage [], const __waitfor_mask_t & mask ) {953 static inline __lock_size_t aggregate( $monitor * storage [], const __waitfor_mask_t & mask ) { 954 954 __lock_size_t size = 0; 955 955 for( __lock_size_t i = 0; i < mask.size; i++ ) { -
libcfa/src/concurrency/monitor.hfa
r0f2c555 rac2b598 23 23 24 24 trait is_monitor(dtype T) { 25 monitor_desc* get_monitor( T & );25 $monitor * get_monitor( T & ); 26 26 void ^?{}( T & mutex ); 27 27 }; 28 28 29 static inline void ?{}( monitor_desc& this) with( this ) {29 static inline void ?{}($monitor & this) with( this ) { 30 30 lock{}; 31 31 entry_queue{}; … … 39 39 } 40 40 41 static inline void ^?{}( monitor_desc& ) {}41 static inline void ^?{}($monitor & ) {} 42 42 43 43 struct monitor_guard_t { 44 monitor_desc** m;44 $monitor ** m; 45 45 __lock_size_t count; 46 46 __monitor_group_t prev; 47 47 }; 48 48 49 void ?{}( monitor_guard_t & this, monitor_desc** m, __lock_size_t count, void (*func)() );49 void ?{}( monitor_guard_t & this, $monitor ** m, __lock_size_t count, void (*func)() ); 50 50 void ^?{}( monitor_guard_t & this ); 51 51 52 52 struct monitor_dtor_guard_t { 53 monitor_desc* m;53 $monitor * m; 54 54 __monitor_group_t prev; 55 55 }; 56 56 57 void ?{}( monitor_dtor_guard_t & this, monitor_desc** m, void (*func)() );57 void ?{}( monitor_dtor_guard_t & this, $monitor ** m, void (*func)() ); 58 58 void ^?{}( monitor_dtor_guard_t & this ); 59 59 … … 72 72 73 73 // The monitor this criterion concerns 74 monitor_desc* target;74 $monitor * target; 75 75 76 76 // The parent node to which this criterion belongs … … 87 87 struct __condition_node_t { 88 88 // Thread that needs to be woken when all criteria are met 89 thread_desc* waiting_thread;89 $thread * waiting_thread; 90 90 91 91 // Array of criteria (Criterions are contiguous in memory) … … 106 106 } 107 107 108 void ?{}(__condition_node_t & this, thread_desc* waiting_thread, __lock_size_t count, uintptr_t user_info );108 void ?{}(__condition_node_t & this, $thread * waiting_thread, __lock_size_t count, uintptr_t user_info ); 109 109 void ?{}(__condition_criterion_t & this ); 110 void ?{}(__condition_criterion_t & this, monitor_desc* target, __condition_node_t * owner );110 void ?{}(__condition_criterion_t & this, $monitor * target, __condition_node_t * owner ); 111 111 112 112 struct condition { … … 115 115 116 116 // Array of monitor pointers (Monitors are NOT contiguous in memory) 117 monitor_desc** monitors;117 $monitor ** monitors; 118 118 119 119 // Number of monitors in the array -
libcfa/src/concurrency/mutex.cfa
r0f2c555 rac2b598 120 120 recursion_count--; 121 121 if( recursion_count == 0 ) { 122 thread_desc* thrd = pop_head( blocked_threads );122 $thread * thrd = pop_head( blocked_threads ); 123 123 owner = thrd; 124 124 recursion_count = (thrd ? 1 : 0); -
libcfa/src/concurrency/mutex.hfa
r0f2c555 rac2b598 36 36 37 37 // List of blocked threads 38 __queue_t(struct thread_desc) blocked_threads;38 __queue_t(struct $thread) blocked_threads; 39 39 40 40 // Locked flag … … 55 55 56 56 // List of blocked threads 57 __queue_t(struct thread_desc) blocked_threads;57 __queue_t(struct $thread) blocked_threads; 58 58 59 59 // Current thread owning the lock 60 struct thread_desc* owner;60 struct $thread * owner; 61 61 62 62 // Number of recursion level … … 83 83 84 84 // List of blocked threads 85 __queue_t(struct thread_desc) blocked_threads;85 __queue_t(struct $thread) blocked_threads; 86 86 }; 87 87 -
libcfa/src/concurrency/preemption.cfa
r0f2c555 rac2b598 39 39 // FwdDeclarations : timeout handlers 40 40 static void preempt( processor * this ); 41 static void timeout( thread_desc* this );41 static void timeout( $thread * this ); 42 42 43 43 // FwdDeclarations : Signal handlers … … 267 267 268 268 // reserved for future use 269 static void timeout( thread_desc* this ) {269 static void timeout( $thread * this ) { 270 270 //TODO : implement waking threads 271 271 } -
libcfa/src/concurrency/thread.cfa
r0f2c555 rac2b598 25 25 //----------------------------------------------------------------------------- 26 26 // Thread ctors and dtors 27 void ?{}( thread_desc& this, const char * const name, cluster & cl, void * storage, size_t storageSize ) with( this ) {27 void ?{}($thread & this, const char * const name, cluster & cl, void * storage, size_t storageSize ) with( this ) { 28 28 context{ 0p, 0p }; 29 29 self_cor{ name, storage, storageSize }; … … 44 44 } 45 45 46 void ^?{}( thread_desc& this) with( this ) {46 void ^?{}($thread& this) with( this ) { 47 47 unregister(curr_cluster, this); 48 48 ^self_cor{}; … … 53 53 forall( dtype T | is_thread(T) ) 54 54 void __thrd_start( T & this, void (*main_p)(T &) ) { 55 thread_desc* this_thrd = get_thread(this);55 $thread * this_thrd = get_thread(this); 56 56 57 57 disable_interrupts(); -
libcfa/src/concurrency/thread.hfa
r0f2c555 rac2b598 28 28 void ^?{}(T& mutex this); 29 29 void main(T& this); 30 thread_desc* get_thread(T& this);30 $thread* get_thread(T& this); 31 31 }; 32 32 33 33 // define that satisfies the trait without using the thread keyword 34 #define DECL_THREAD(X) thread_desc* get_thread(X& this) __attribute__((const)) { return &this.__thrd; } void main(X& this)34 #define DECL_THREAD(X) $thread* get_thread(X& this) __attribute__((const)) { return &this.__thrd; } void main(X& this) 35 35 36 36 // Inline getters for threads/coroutines/monitors 37 37 forall( dtype T | is_thread(T) ) 38 static inline coroutine_desc* get_coroutine(T & this) __attribute__((const)) { return &get_thread(this)->self_cor; }38 static inline $coroutine* get_coroutine(T & this) __attribute__((const)) { return &get_thread(this)->self_cor; } 39 39 40 40 forall( dtype T | is_thread(T) ) 41 static inline monitor_desc* get_monitor (T & this) __attribute__((const)) { return &get_thread(this)->self_mon; }41 static inline $monitor * get_monitor (T & this) __attribute__((const)) { return &get_thread(this)->self_mon; } 42 42 43 static inline coroutine_desc* get_coroutine(thread_desc* this) __attribute__((const)) { return &this->self_cor; }44 static inline monitor_desc * get_monitor (thread_desc* this) __attribute__((const)) { return &this->self_mon; }43 static inline $coroutine* get_coroutine($thread * this) __attribute__((const)) { return &this->self_cor; } 44 static inline $monitor * get_monitor ($thread * this) __attribute__((const)) { return &this->self_mon; } 45 45 46 46 //----------------------------------------------------------------------------- … … 53 53 //----------------------------------------------------------------------------- 54 54 // Ctors and dtors 55 void ?{}( thread_desc& this, const char * const name, struct cluster & cl, void * storage, size_t storageSize );56 void ^?{}( thread_desc& this);55 void ?{}($thread & this, const char * const name, struct cluster & cl, void * storage, size_t storageSize ); 56 void ^?{}($thread & this); 57 57 58 static inline void ?{}( thread_desc& this) { this{ "Anonymous Thread", *mainCluster, 0p, 65000 }; }59 static inline void ?{}( thread_desc& this, size_t stackSize ) { this{ "Anonymous Thread", *mainCluster, 0p, stackSize }; }60 static inline void ?{}( thread_desc& this, void * storage, size_t storageSize ) { this{ "Anonymous Thread", *mainCluster, storage, storageSize }; }61 static inline void ?{}( thread_desc& this, struct cluster & cl ) { this{ "Anonymous Thread", cl, 0p, 65000 }; }62 static inline void ?{}( thread_desc& this, struct cluster & cl, size_t stackSize ) { this{ "Anonymous Thread", cl, 0p, stackSize }; }63 static inline void ?{}( thread_desc& this, struct cluster & cl, void * storage, size_t storageSize ) { this{ "Anonymous Thread", cl, storage, storageSize }; }64 static inline void ?{}( thread_desc& this, const char * const name) { this{ name, *mainCluster, 0p, 65000 }; }65 static inline void ?{}( thread_desc& this, const char * const name, struct cluster & cl ) { this{ name, cl, 0p, 65000 }; }66 static inline void ?{}( thread_desc& this, const char * const name, struct cluster & cl, size_t stackSize ) { this{ name, cl, 0p, stackSize }; }58 static inline void ?{}($thread & this) { this{ "Anonymous Thread", *mainCluster, 0p, 65000 }; } 59 static inline void ?{}($thread & this, size_t stackSize ) { this{ "Anonymous Thread", *mainCluster, 0p, stackSize }; } 60 static inline void ?{}($thread & this, void * storage, size_t storageSize ) { this{ "Anonymous Thread", *mainCluster, storage, storageSize }; } 61 static inline void ?{}($thread & this, struct cluster & cl ) { this{ "Anonymous Thread", cl, 0p, 65000 }; } 62 static inline void ?{}($thread & this, struct cluster & cl, size_t stackSize ) { this{ "Anonymous Thread", cl, 0p, stackSize }; } 63 static inline void ?{}($thread & this, struct cluster & cl, void * storage, size_t storageSize ) { this{ "Anonymous Thread", cl, storage, storageSize }; } 64 static inline void ?{}($thread & this, const char * const name) { this{ name, *mainCluster, 0p, 65000 }; } 65 static inline void ?{}($thread & this, const char * const name, struct cluster & cl ) { this{ name, cl, 0p, 65000 }; } 66 static inline void ?{}($thread & this, const char * const name, struct cluster & cl, size_t stackSize ) { this{ name, cl, 0p, stackSize }; } 67 67 68 68 //----------------------------------------------------------------------------- … … 85 85 //----------------------------------------------------------------------------- 86 86 // Thread getters 87 static inline struct thread_desc* active_thread () { return TL_GET( this_thread ); }87 static inline struct $thread * active_thread () { return TL_GET( this_thread ); } 88 88 89 89 //----------------------------------------------------------------------------- … … 97 97 // Unpark a thread, if the thread is already blocked, schedule it 98 98 // if the thread is not yet block, signal that it should rerun immediately 99 void unpark( thread_desc* this );99 void unpark( $thread * this ); 100 100 101 101 forall( dtype T | is_thread(T) )
Note: See TracChangeset
for help on using the changeset viewer.