Ignore:
Timestamp:
Apr 24, 2021, 11:32:49 AM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
424dfc4, 986cb99
Parents:
fec63b2 (diff), 8edbe40 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    rfec63b2 r50f6afb  
    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.