Ignore:
File:
1 edited

Legend:

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

    r9cc3a18 rfd54fef  
    3939        link.next = 0p;
    4040        link.prev = 0p;
     41        link.preferred = -1;
    4142        #if defined( __CFA_WITH_VERIFY__ )
    4243                canary = 0x0D15EA5E0D15EA5Ep;
     
    6162}
    6263
    63 EHM_VIRTUAL_TABLE(SomeThreadCancelled, std_thread_cancelled);
     64FORALL_DATA_INSTANCE(ThreadCancelled, (thread_t &), (thread_t))
    6465
    6566forall(T &)
     
    7273forall(T &)
    7374const char * msg(ThreadCancelled(T) *) {
    74         return "ThreadCancelled(...)";
     75        return "ThreadCancelled";
    7576}
    7677
    7778forall(T &)
    7879static void default_thread_cancel_handler(ThreadCancelled(T) & ) {
    79         // Improve this error message, can I do formatting?
    8080        abort( "Unhandled thread cancellation.\n" );
    8181}
    8282
    83 static void default_thread_cancel_handler(SomeThreadCancelled & ) {
    84         // Improve this error message, can I do formatting?
    85         abort( "Unhandled thread cancellation.\n" );
    86 }
    87 
    88 forall(T & | is_thread(T) | IS_EXCEPTION(SomeThreadCancelled))
     83forall(T & | is_thread(T) | IS_EXCEPTION(ThreadCancelled, (T)))
    8984void ?{}( thread_dtor_guard_t & this,
    90                 T & thrd, void(*cancelHandler)(SomeThreadCancelled &)) {
    91         $monitor * m = get_monitor(thrd);
     85                T & thrd, void(*cancelHandler)(ThreadCancelled(T) &)) {
     86        $monitor * m = get_monitor(thrd);
    9287        $thread * desc = get_thread(thrd);
    9388
    9489        // Setup the monitor guard
    9590        void (*dtor)(T& mutex this) = ^?{};
    96         bool join = cancelHandler != (void(*)(SomeThreadCancelled&))0;
     91        bool join = cancelHandler != (void(*)(ThreadCancelled(T)&))0;
    9792        (this.mg){&m, (void(*)())dtor, join};
    9893
     
    108103        }
    109104        desc->state = Cancelled;
    110         void(*defaultResumptionHandler)(SomeThreadCancelled &) =
     105        void(*defaultResumptionHandler)(ThreadCancelled(T) &) =
    111106                join ? cancelHandler : default_thread_cancel_handler;
    112107
     108        ThreadCancelled(T) except;
    113109        // TODO: Remove explitate vtable set once trac#186 is fixed.
    114         SomeThreadCancelled except;
    115         except.virtual_table = &std_thread_cancelled;
     110        except.virtual_table = &get_exception_vtable(&except);
    116111        except.the_thread = &thrd;
    117112        except.the_exception = __cfaehm_cancellation_exception( cancellation );
    118         // Why is this cast required?
    119         throwResume (SomeThreadCancelled &)except;
     113        throwResume except;
    120114
    121115        except.the_exception->virtual_table->free( except.the_exception );
     
    164158
    165159//-----------------------------------------------------------------------------
    166 forall(T & | is_thread(T) | IS_RESUMPTION_EXCEPTION(SomeThreadCancelled))
     160forall(T & | is_thread(T) | IS_RESUMPTION_EXCEPTION(ThreadCancelled, (T)))
    167161T & join( T & this ) {
    168162        thread_dtor_guard_t guard = { this, defaultResumptionHandler };
Note: See TracChangeset for help on using the changeset viewer.