Changes in / [5625427:8d182b1]


Ignore:
Files:
2 added
1 edited

Legend:

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

    r5625427 r8d182b1  
    318318void defaultResumeAtHandler( exception_t * except ) {
    319319    __cfaehm_allocate_exception( except );
    320     free( except );
    321320    __cfaehm_begin_unwind( (void(*)(exception_t *))defaultTerminationHandler );
    322321}
     322
     323struct ehm_cleanup {
     324        exception_t * ex;
     325};
     326
     327void ^?{}( ehm_cleanup & this ) { free( this.ex ); }
    323328
    324329bool poll( coroutine$ * cor ) libcfa_public {
     
    330335    // otherwise loop and throwResume all pending exceptions
    331336    while ( nl_ex != 0p ){
    332         exception_t * ex = nl_ex->the_exception;
     337                ehm_cleanup ex_holder{ nl_ex->the_exception };
    333338        free( nl_ex );
    334         __cfaehm_throw_resume( ex, defaultResumeAtHandler );
     339        __cfaehm_throw_resume( ex_holder.ex , defaultResumeAtHandler );
    335340       
    336         // only reached if resumption handled. other dealloc handled in defaultResumeAtHandler
    337         free( ex );
    338341        nl_ex = pop_ehm_head( cor );
    339342    }
Note: See TracChangeset for help on using the changeset viewer.