Ignore:
File:
1 edited

Legend:

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

    r9cc3a18 r8edbe40  
    6161}
    6262
    63 EHM_VIRTUAL_TABLE(SomeThreadCancelled, std_thread_cancelled);
    64 
    6563forall(T &)
    6664void copy(ThreadCancelled(T) * dst, ThreadCancelled(T) * src) {
     
    8179}
    8280
    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))
     81forall(T & | is_thread(T) | IS_EXCEPTION(ThreadCancelled, (T))
     82    | { _EHM_VTABLE_TYPE(ThreadCancelled)(T) & const _default_vtable; })
    8983void ?{}( thread_dtor_guard_t & this,
    90                 T & thrd, void(*cancelHandler)(SomeThreadCancelled &)) {
     84                T & thrd, void(*cancelHandler)(ThreadCancelled(T) &)) {
    9185        $monitor * m = get_monitor(thrd);
    9286        $thread * desc = get_thread(thrd);
     
    9488        // Setup the monitor guard
    9589        void (*dtor)(T& mutex this) = ^?{};
    96         bool join = cancelHandler != (void(*)(SomeThreadCancelled&))0;
     90        bool join = cancelHandler != (void(*)(ThreadCancelled(T)&))0;
    9791        (this.mg){&m, (void(*)())dtor, join};
    9892
     
    108102        }
    109103        desc->state = Cancelled;
    110         void(*defaultResumptionHandler)(SomeThreadCancelled &) =
     104        void(*defaultResumptionHandler)(ThreadCancelled(T) &) =
    111105                join ? cancelHandler : default_thread_cancel_handler;
    112106
    113107        // TODO: Remove explitate vtable set once trac#186 is fixed.
    114         SomeThreadCancelled except;
    115         except.virtual_table = &std_thread_cancelled;
     108        ThreadCancelled(T) except;
     109        except.virtual_table = &_default_vtable;
    116110        except.the_thread = &thrd;
    117111        except.the_exception = __cfaehm_cancellation_exception( cancellation );
    118112        // Why is this cast required?
    119         throwResume (SomeThreadCancelled &)except;
     113        throwResume (ThreadCancelled(T) &)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))
     161    | { _EHM_VTABLE_TYPE(ThreadCancelled)(T) & const _default_vtable; })
    167162T & join( T & this ) {
    168163        thread_dtor_guard_t guard = { this, defaultResumptionHandler };
Note: See TracChangeset for help on using the changeset viewer.