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