Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/coroutines

    r0c92c9f r77e6fcb  
    3030};
    3131
    32 #define DECL_COROUTINE(X) static inline coroutine* get_coroutine(X* this) { return &this->c; } void main(X* this);
     32#define DECL_COROUTINE(X) static inline coroutine* get_coroutine(X* this) { return &this->c; } void main(X* this)
    3333
    3434//-----------------------------------------------------------------------------
     
    110110}
    111111
     112static inline void resume(coroutine * dst) {
     113        coroutine * src = this_coroutine();             // optimization
     114
     115      // not resuming self ?
     116        if ( src != dst ) {
     117                assertf( dst->notHalted ,
     118                        "Attempt by coroutine %.256s (%p) to resume terminated coroutine %.256s (%p).\n"
     119                        "Possible cause is terminated coroutine's main routine has already returned.",
     120                        src->name, src, dst->name, dst );
     121
     122            // set last resumer
     123                dst->last = src;
     124        } // if
     125
     126      // always done for performance testing
     127        CoroutineCtxSwitch( src, dst );
     128}
     129
    112130#endif //COROUTINES_H
    113131
Note: See TracChangeset for help on using the changeset viewer.