Ignore:
File:
1 edited

Legend:

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

    recfd758 rfd54fef  
    6262}
    6363
    64 EHM_VIRTUAL_TABLE(SomeThreadCancelled, std_thread_cancelled);
     64FORALL_DATA_INSTANCE(ThreadCancelled, (thread_t &), (thread_t))
    6565
    6666forall(T &)
     
    7373forall(T &)
    7474const char * msg(ThreadCancelled(T) *) {
    75         return "ThreadCancelled(...)";
     75        return "ThreadCancelled";
    7676}
    7777
    7878forall(T &)
    7979static void default_thread_cancel_handler(ThreadCancelled(T) & ) {
    80         // Improve this error message, can I do formatting?
    8180        abort( "Unhandled thread cancellation.\n" );
    8281}
    8382
    84 static void default_thread_cancel_handler(SomeThreadCancelled & ) {
    85         // Improve this error message, can I do formatting?
    86         abort( "Unhandled thread cancellation.\n" );
    87 }
    88 
    89 forall(T & | is_thread(T) | IS_EXCEPTION(SomeThreadCancelled))
     83forall(T & | is_thread(T) | IS_EXCEPTION(ThreadCancelled, (T)))
    9084void ?{}( thread_dtor_guard_t & this,
    91                 T & thrd, void(*cancelHandler)(SomeThreadCancelled &)) {
    92         $monitor * m = get_monitor(thrd);
     85                T & thrd, void(*cancelHandler)(ThreadCancelled(T) &)) {
     86        $monitor * m = get_monitor(thrd);
    9387        $thread * desc = get_thread(thrd);
    9488
    9589        // Setup the monitor guard
    9690        void (*dtor)(T& mutex this) = ^?{};
    97         bool join = cancelHandler != (void(*)(SomeThreadCancelled&))0;
     91        bool join = cancelHandler != (void(*)(ThreadCancelled(T)&))0;
    9892        (this.mg){&m, (void(*)())dtor, join};
    9993
     
    109103        }
    110104        desc->state = Cancelled;
    111         void(*defaultResumptionHandler)(SomeThreadCancelled &) =
     105        void(*defaultResumptionHandler)(ThreadCancelled(T) &) =
    112106                join ? cancelHandler : default_thread_cancel_handler;
    113107
     108        ThreadCancelled(T) except;
    114109        // TODO: Remove explitate vtable set once trac#186 is fixed.
    115         SomeThreadCancelled except;
    116         except.virtual_table = &std_thread_cancelled;
     110        except.virtual_table = &get_exception_vtable(&except);
    117111        except.the_thread = &thrd;
    118112        except.the_exception = __cfaehm_cancellation_exception( cancellation );
    119         // Why is this cast required?
    120         throwResume (SomeThreadCancelled &)except;
     113        throwResume except;
    121114
    122115        except.the_exception->virtual_table->free( except.the_exception );
     
    165158
    166159//-----------------------------------------------------------------------------
    167 forall(T & | is_thread(T) | IS_RESUMPTION_EXCEPTION(SomeThreadCancelled))
     160forall(T & | is_thread(T) | IS_RESUMPTION_EXCEPTION(ThreadCancelled, (T)))
    168161T & join( T & this ) {
    169162        thread_dtor_guard_t guard = { this, defaultResumptionHandler };
Note: See TracChangeset for help on using the changeset viewer.