Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/thread.cfa

    rfd54fef r5456537  
    3939        link.next = 0p;
    4040        link.prev = 0p;
    41         link.preferred = -1;
    4241        #if defined( __CFA_WITH_VERIFY__ )
    4342                canary = 0x0D15EA5E0D15EA5Ep;
     
    6261}
    6362
    64 FORALL_DATA_INSTANCE(ThreadCancelled, (thread_t &), (thread_t))
    65 
    6663forall(T &)
    6764void copy(ThreadCancelled(T) * dst, ThreadCancelled(T) * src) {
     
    7370forall(T &)
    7471const char * msg(ThreadCancelled(T) *) {
    75         return "ThreadCancelled";
     72        return "ThreadCancelled(...)";
    7673}
    7774
    7875forall(T &)
    7976static void default_thread_cancel_handler(ThreadCancelled(T) & ) {
     77        // Improve this error message, can I do formatting?
    8078        abort( "Unhandled thread cancellation.\n" );
    8179}
    8280
    83 forall(T & | is_thread(T) | IS_EXCEPTION(ThreadCancelled, (T)))
     81forall(T & | is_thread(T) | IS_EXCEPTION(ThreadCancelled, (T))
     82    | { EHM_DEFAULT_VTABLE(ThreadCancelled, (T)); })
    8483void ?{}( thread_dtor_guard_t & this,
    8584                T & thrd, void(*cancelHandler)(ThreadCancelled(T) &)) {
    86         $monitor * m = get_monitor(thrd);
     85        $monitor * m = get_monitor(thrd);
    8786        $thread * desc = get_thread(thrd);
    8887
     
    103102        }
    104103        desc->state = Cancelled;
    105         void(*defaultResumptionHandler)(ThreadCancelled(T) &) = 
     104        void(*defaultResumptionHandler)(ThreadCancelled(T) &) =
    106105                join ? cancelHandler : default_thread_cancel_handler;
    107106
     107        // TODO: Remove explitate vtable set once trac#186 is fixed.
    108108        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;
    111110        except.the_thread = &thrd;
    112111        except.the_exception = __cfaehm_cancellation_exception( cancellation );
    113         throwResume except;
     112        // Why is this cast required?
     113        throwResume (ThreadCancelled(T) &)except;
    114114
    115115        except.the_exception->virtual_table->free( except.the_exception );
     
    134134        /* paranoid */ verify( this_thrd->context.SP );
    135135
    136         __schedule_thread( this_thrd );
    137         enable_interrupts( __cfaabi_dbg_ctx );
     136        schedule_thread$( this_thrd );
     137        enable_interrupts();
    138138}
    139139
     
    158158
    159159//-----------------------------------------------------------------------------
    160 forall(T & | is_thread(T) | IS_RESUMPTION_EXCEPTION(ThreadCancelled, (T)))
     160forall(T & | is_thread(T) | IS_RESUMPTION_EXCEPTION(ThreadCancelled, (T))
     161    | { EHM_DEFAULT_VTABLE(ThreadCancelled, (T)); })
    161162T & join( T & this ) {
    162163        thread_dtor_guard_t guard = { this, defaultResumptionHandler };
     
    167168        disable_interrupts();
    168169        uint64_t ret = __tls_rand();
    169         enable_interrupts( __cfaabi_dbg_ctx );
     170        enable_interrupts();
    170171        return ret;
    171172}
Note: See TracChangeset for help on using the changeset viewer.