Ignore:
Timestamp:
Aug 25, 2017, 12:11:53 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
bf7b9da7
Parents:
135b431 (diff), f676b84 (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/coroutine

    r135b431 r6b224a52  
    2525// Anything that is resumed is a coroutine.
    2626trait is_coroutine(dtype T) {
    27       void main(T * this);
    28       coroutine_desc * get_coroutine(T * this);
     27      void main(T & this);
     28      coroutine_desc * get_coroutine(T & this);
    2929};
    3030
    31 #define DECL_COROUTINE(X) static inline coroutine_desc* get_coroutine(X* this) { return &this->__cor; } void main(X* this)
     31#define DECL_COROUTINE(X) static inline coroutine_desc* get_coroutine(X& this) { return &this.__cor; } void main(X& this)
    3232
    3333//-----------------------------------------------------------------------------
    3434// Ctors and dtors
    35 void ?{}(coStack_t * this);
    36 void ?{}(coroutine_desc * this);
    37 void ?{}(coroutine_desc * this, const char * name);
    38 void ^?{}(coStack_t * this);
    39 void ^?{}(coroutine_desc * this);
     35void ?{}(coStack_t & this);
     36void ?{}(coroutine_desc & this);
     37void ?{}(coroutine_desc & this, const char * name);
     38void ^?{}(coStack_t & this);
     39void ^?{}(coroutine_desc & this);
    4040
    4141//-----------------------------------------------------------------------------
     
    4444
    4545forall(dtype T | is_coroutine(T))
    46 static inline void resume(T * cor);
     46static inline void resume(T & cor);
    4747
    4848forall(dtype T | is_coroutine(T))
    49 void prime(T * cor);
     49void prime(T & cor);
    5050
    5151//-----------------------------------------------------------------------------
     
    8686// Resume implementation inlined for performance
    8787forall(dtype T | is_coroutine(T))
    88 static inline void resume(T * cor) {
     88static inline void resume(T & cor) {
    8989        coroutine_desc * src = this_coroutine;          // optimization
    9090        coroutine_desc * dst = get_coroutine(cor);
     
    9292        if( unlikely(!dst->stack.base) ) {
    9393                create_stack(&dst->stack, dst->stack.size);
    94                 CtxStart(cor, CtxInvokeCoroutine);
     94                CtxStart(&cor, CtxInvokeCoroutine);
    9595        }
    9696
Note: See TracChangeset for help on using the changeset viewer.