Ignore:
Timestamp:
Apr 21, 2021, 3:44:58 PM (3 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
578c09a
Parents:
7711064
Message:

Recovered the polymorphic CoroutineCancelled? exception. The interface might need a bit of polish.

File:
1 edited

Legend:

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

    r7711064 rb583113  
    4646
    4747//-----------------------------------------------------------------------------
    48 EHM_VIRTUAL_TABLE(SomeCoroutineCancelled, std_coroutine_cancelled);
    49 
    5048forall(T &)
    5149void copy(CoroutineCancelled(T) * dst, CoroutineCancelled(T) * src) {
     
    6260// This code should not be inlined. It is the error path on resume.
    6361forall(T & | is_coroutine(T))
    64 void __cfaehm_cancelled_coroutine( T & cor, $coroutine * desc ) {
     62void __cfaehm_cancelled_coroutine(
     63                T & cor, $coroutine * desc, _EHM_VTABLE_TYPE(CoroutineCancelled)(T) & const _default_vtable ) {
    6564        verify( desc->cancellation );
    6665        desc->state = Cancelled;
     
    6867
    6968        // TODO: Remove explitate vtable set once trac#186 is fixed.
    70         SomeCoroutineCancelled except;
    71         except.virtual_table = &std_coroutine_cancelled;
     69        CoroutineCancelled(T) except;
     70        except.virtual_table = &_default_vtable;
    7271        except.the_coroutine = &cor;
    7372        except.the_exception = except;
    7473        // Why does this need a cast?
    75         throwResume (SomeCoroutineCancelled &)except;
     74        throwResume (CoroutineCancelled(T) &)except;
    7675
    7776        except->virtual_table->free( except );
     
    146145// Part of the Public API
    147146// Not inline since only ever called once per coroutine
    148 forall(T & | is_coroutine(T))
     147forall(T & | is_coroutine(T) | { _EHM_VTABLE_TYPE(CoroutineCancelled)(T) & const _default_vtable; })
    149148void prime(T& cor) {
    150149        $coroutine* this = get_coroutine(cor);
Note: See TracChangeset for help on using the changeset viewer.