- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/thread.cfa
rfd54fef r5456537 39 39 link.next = 0p; 40 40 link.prev = 0p; 41 link.preferred = -1;42 41 #if defined( __CFA_WITH_VERIFY__ ) 43 42 canary = 0x0D15EA5E0D15EA5Ep; … … 62 61 } 63 62 64 FORALL_DATA_INSTANCE(ThreadCancelled, (thread_t &), (thread_t))65 66 63 forall(T &) 67 64 void copy(ThreadCancelled(T) * dst, ThreadCancelled(T) * src) { … … 73 70 forall(T &) 74 71 const char * msg(ThreadCancelled(T) *) { 75 return "ThreadCancelled ";72 return "ThreadCancelled(...)"; 76 73 } 77 74 78 75 forall(T &) 79 76 static void default_thread_cancel_handler(ThreadCancelled(T) & ) { 77 // Improve this error message, can I do formatting? 80 78 abort( "Unhandled thread cancellation.\n" ); 81 79 } 82 80 83 forall(T & | is_thread(T) | IS_EXCEPTION(ThreadCancelled, (T))) 81 forall(T & | is_thread(T) | IS_EXCEPTION(ThreadCancelled, (T)) 82 | { EHM_DEFAULT_VTABLE(ThreadCancelled, (T)); }) 84 83 void ?{}( thread_dtor_guard_t & this, 85 84 T & thrd, void(*cancelHandler)(ThreadCancelled(T) &)) { 86 85 $monitor * m = get_monitor(thrd); 87 86 $thread * desc = get_thread(thrd); 88 87 … … 103 102 } 104 103 desc->state = Cancelled; 105 void(*defaultResumptionHandler)(ThreadCancelled(T) &) = 104 void(*defaultResumptionHandler)(ThreadCancelled(T) &) = 106 105 join ? cancelHandler : default_thread_cancel_handler; 107 106 107 // TODO: Remove explitate vtable set once trac#186 is fixed. 108 108 ThreadCancelled(T) except; 109 // TODO: Remove explitate vtable set once trac#186 is fixed. 110 except.virtual_table = &get_exception_vtable(&except); 109 except.virtual_table = &_default_vtable; 111 110 except.the_thread = &thrd; 112 111 except.the_exception = __cfaehm_cancellation_exception( cancellation ); 113 throwResume except; 112 // Why is this cast required? 113 throwResume (ThreadCancelled(T) &)except; 114 114 115 115 except.the_exception->virtual_table->free( except.the_exception ); … … 134 134 /* paranoid */ verify( this_thrd->context.SP ); 135 135 136 __schedule_thread( this_thrd );137 enable_interrupts( __cfaabi_dbg_ctx);136 schedule_thread$( this_thrd ); 137 enable_interrupts(); 138 138 } 139 139 … … 158 158 159 159 //----------------------------------------------------------------------------- 160 forall(T & | is_thread(T) | IS_RESUMPTION_EXCEPTION(ThreadCancelled, (T))) 160 forall(T & | is_thread(T) | IS_RESUMPTION_EXCEPTION(ThreadCancelled, (T)) 161 | { EHM_DEFAULT_VTABLE(ThreadCancelled, (T)); }) 161 162 T & join( T & this ) { 162 163 thread_dtor_guard_t guard = { this, defaultResumptionHandler }; … … 167 168 disable_interrupts(); 168 169 uint64_t ret = __tls_rand(); 169 enable_interrupts( __cfaabi_dbg_ctx);170 enable_interrupts(); 170 171 return ret; 171 172 }
Note:
See TracChangeset
for help on using the changeset viewer.