Ignore:
File:
1 edited

Legend:

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

    r5456537 rfd54fef  
    3939        link.next = 0p;
    4040        link.prev = 0p;
     41        link.preferred = -1;
    4142        #if defined( __CFA_WITH_VERIFY__ )
    4243                canary = 0x0D15EA5E0D15EA5Ep;
     
    6162}
    6263
     64FORALL_DATA_INSTANCE(ThreadCancelled, (thread_t &), (thread_t))
     65
    6366forall(T &)
    6467void copy(ThreadCancelled(T) * dst, ThreadCancelled(T) * src) {
     
    7073forall(T &)
    7174const char * msg(ThreadCancelled(T) *) {
    72         return "ThreadCancelled(...)";
     75        return "ThreadCancelled";
    7376}
    7477
    7578forall(T &)
    7679static void default_thread_cancel_handler(ThreadCancelled(T) & ) {
    77         // Improve this error message, can I do formatting?
    7880        abort( "Unhandled thread cancellation.\n" );
    7981}
    8082
    81 forall(T & | is_thread(T) | IS_EXCEPTION(ThreadCancelled, (T))
    82     | { EHM_DEFAULT_VTABLE(ThreadCancelled, (T)); })
     83forall(T & | is_thread(T) | IS_EXCEPTION(ThreadCancelled, (T)))
    8384void ?{}( thread_dtor_guard_t & this,
    8485                T & thrd, void(*cancelHandler)(ThreadCancelled(T) &)) {
    85         $monitor * m = get_monitor(thrd);
     86        $monitor * m = get_monitor(thrd);
    8687        $thread * desc = get_thread(thrd);
    8788
     
    102103        }
    103104        desc->state = Cancelled;
    104         void(*defaultResumptionHandler)(ThreadCancelled(T) &) =
     105        void(*defaultResumptionHandler)(ThreadCancelled(T) &) = 
    105106                join ? cancelHandler : default_thread_cancel_handler;
    106107
     108        ThreadCancelled(T) except;
    107109        // 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);
    110111        except.the_thread = &thrd;
    111112        except.the_exception = __cfaehm_cancellation_exception( cancellation );
    112         // Why is this cast required?
    113         throwResume (ThreadCancelled(T) &)except;
     113        throwResume 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();
     136        __schedule_thread( this_thrd );
     137        enable_interrupts( __cfaabi_dbg_ctx );
    138138}
    139139
     
    158158
    159159//-----------------------------------------------------------------------------
    160 forall(T & | is_thread(T) | IS_RESUMPTION_EXCEPTION(ThreadCancelled, (T))
    161     | { EHM_DEFAULT_VTABLE(ThreadCancelled, (T)); })
     160forall(T & | is_thread(T) | IS_RESUMPTION_EXCEPTION(ThreadCancelled, (T)))
    162161T & join( T & this ) {
    163162        thread_dtor_guard_t guard = { this, defaultResumptionHandler };
     
    168167        disable_interrupts();
    169168        uint64_t ret = __tls_rand();
    170         enable_interrupts();
     169        enable_interrupts( __cfaabi_dbg_ctx );
    171170        return ret;
    172171}
Note: See TracChangeset for help on using the changeset viewer.