Ignore:
File:
1 edited

Legend:

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

    r23edb61 r3318dff  
    7878        free( desc->cancellation );
    7979        desc->cancellation = 0p;
    80 }
    81 
    82 // helper for popping from coroutine's ehm buffer
    83 inline nonlocal_exception * pop_ehm_head( coroutine$ * this ) {
    84     lock( this->ehm_state.buffer_lock __cfaabi_dbg_ctx2 );
    85     nonlocal_exception * nl_ex = pop_head( this->ehm_state.ehm_buffer );
    86     unlock( this->ehm_state.buffer_lock );
    87     return nl_ex;
    8880}
    8981
     
    136128
    137129void ^?{}(coroutine$& this) libcfa_public {
    138     // handle any leftover pending non-local exceptions
    139     nonlocal_exception * nl_ex = pop_ehm_head( &this );
    140     unsigned unhandled_ex = 0;
    141    
    142     // if any leftover exceptions handle
    143     while ( nl_ex != 0p ){
    144         unhandled_ex++;
    145         free( nl_ex->the_exception );
    146         free( nl_ex );
    147         nl_ex = pop_ehm_head( &this );
    148     }
    149 
    150     #ifdef __CFA_DEBUG__
    151     if ( unhandled_ex > 0 )
    152         printf( "Warning: Coroutine %p exited with %u pending nonlocal exceptions.\n", &this, unhandled_ex );
    153     #endif
    154 
    155130        if(this.state != Halted && this.state != Start && this.state != Primed) {
    156131                coroutine$ * src = active_coroutine();
     
    316291// non local ehm routines
    317292
     293// helper for popping from coroutine's ehm buffer
     294inline nonlocal_exception * pop_ehm_head( coroutine$ * this ) {
     295    lock( this->ehm_state.buffer_lock __cfaabi_dbg_ctx2 );
     296    nonlocal_exception * nl_ex = pop_head( this->ehm_state.ehm_buffer );
     297    unlock( this->ehm_state.buffer_lock );
     298    return nl_ex;
     299}
     300
    318301void defaultResumeAtHandler( exception_t * except ) {
    319302    __cfaehm_allocate_exception( except );
Note: See TracChangeset for help on using the changeset viewer.