Changeset 4b30318b for libcfa


Ignore:
Timestamp:
Sep 2, 2023, 3:07:49 PM (8 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
6e93819
Parents:
389fbf5 (diff), 8a9a3ab (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

Location:
libcfa/src/concurrency
Files:
3 edited

Legend:

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

    r389fbf5 r4b30318b  
    344344bool poll() libcfa_public { return poll( active_coroutine() ); }
    345345coroutine$ * resumer() libcfa_public { return active_coroutine()->last; }
     346coroutine$ * first_resumer() libcfa_public { return active_coroutine()->starter; }
    346347
    347348// user facing ehm operations
     
    358359
    359360    coroutine$ * resumer( T & cor ) libcfa_public { return get_coroutine( cor )->last; }
     361    coroutine$ * first_resumer( T & cor ) libcfa_public { return get_coroutine( cor )->starter; }
    360362}
    361363
  • libcfa/src/concurrency/coroutine.hfa

    r389fbf5 r4b30318b  
    124124        src->state = Active;
    125125
    126         if( unlikely(src->cancellation != 0p) ) {
     126        if( unlikely(src->cancellation != 0p && src->cancellation != 1p) ) {
    127127                __cfactx_coroutine_unwind(src->cancellation, src);
    128128        }
     
    169169        coroutine$ * dst = get_coroutine(cor);
    170170
     171    // printf("FROM RES src: %p, dest: %p\n", src, dst);
     172
    171173        if( unlikely(dst->context.SP == 0p) ) {
    172174                __stack_prepare(&dst->stack, DEFAULT_STACK_SIZE);
     
    188190        // always done for performance testing
    189191        $ctx_switch( src, dst );
    190         if ( unlikely(dst->cancellation) ) {
     192
     193        if ( unlikely(src->cancellation == 1p) ) {
     194        src->cancellation = 0p;
     195        // we know dst hasn't been deallocated
    191196                __cfaehm_cancelled_coroutine( cor, dst, _default_vtable );
    192197        }
     
    222227bool poll();
    223228coroutine$ * resumer();
     229coroutine$ * first_resumer();
    224230
    225231forall(T & | is_coroutine(T)) {
     
    229235    bool checked_poll( T & cor );
    230236    coroutine$ * resumer( T & cor );
     237    coroutine$ * first_resumer( T & cor );
    231238}
    232239
  • libcfa/src/concurrency/exception.cfa

    r389fbf5 r4b30318b  
    5757        struct coroutine$ * src = (coroutine$ *)stop_param;
    5858        struct coroutine$ * dst = src->last;
    59 
     59    dst->cancellation = 1p;
    6060        $ctx_switch( src, dst );
    6161        abort();
Note: See TracChangeset for help on using the changeset viewer.