Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/coroutine

    r14a61b5 rb10affd  
    3232//-----------------------------------------------------------------------------
    3333// Ctors and dtors
    34 // void ?{}( coStack_t & this );
    35 // void ^?{}( coStack_t & this );
    36 
    37 void ?{}( coroutine_desc & this, const char * name, void * storage, size_t storageSize );
    38 void ^?{}( coroutine_desc & this );
    39 
    40 static inline void ?{}( coroutine_desc & this)                                       { this{ "Anonymous Coroutine", NULL, 0 }; }
    41 static inline void ?{}( coroutine_desc & this, size_t stackSize)                     { this{ "Anonymous Coroutine", NULL, stackSize }; }
    42 static inline void ?{}( coroutine_desc & this, void * storage, size_t storageSize )  { this{ "Anonymous Coroutine", storage, storageSize }; }
    43 static inline void ?{}( coroutine_desc & this, const char * name)                    { this{ name, NULL, 0 }; }
    44 static inline void ?{}( coroutine_desc & this, const char * name, size_t stackSize ) { this{ name, NULL, stackSize }; }
     34void ?{}(coStack_t & this);
     35void ?{}(coroutine_desc & this);
     36void ?{}(coroutine_desc & this, const char * name);
     37void ^?{}(coStack_t & this);
     38void ^?{}(coroutine_desc & this);
    4539
    4640//-----------------------------------------------------------------------------
     
    7266// Suspend implementation inlined for performance
    7367static inline void suspend() {
    74         // optimization : read TLS once and reuse it
    75         // Safety note: this is preemption safe since if
    76         // preemption occurs after this line, the pointer
    77         // will also migrate which means this value will
    78         // stay in syn with the TLS
    79         coroutine_desc * src = TL_GET( this_coroutine );
     68        coroutine_desc * src = TL_GET( this_coroutine );                        // optimization
    8069
    8170        assertf( src->last != 0,
     
    9483forall(dtype T | is_coroutine(T))
    9584static inline void resume(T & cor) {
    96         // optimization : read TLS once and reuse it
    97         // Safety note: this is preemption safe since if
    98         // preemption occurs after this line, the pointer
    99         // will also migrate which means this value will
    100         // stay in syn with the TLS
    101         coroutine_desc * src = TL_GET( this_coroutine );
     85        coroutine_desc * src = TL_GET( this_coroutine );                        // optimization
    10286        coroutine_desc * dst = get_coroutine(cor);
    10387
     
    117101                dst->last = src;
    118102                dst->starter = dst->starter ? dst->starter : src;
    119         }
     103        } // if
    120104
    121105        // always done for performance testing
     
    124108
    125109static inline void resume(coroutine_desc * dst) {
    126         // optimization : read TLS once and reuse it
    127         // Safety note: this is preemption safe since if
    128         // preemption occurs after this line, the pointer
    129         // will also migrate which means this value will
    130         // stay in syn with the TLS
    131         coroutine_desc * src = TL_GET( this_coroutine );
     110        coroutine_desc * src = TL_GET( this_coroutine );                        // optimization
    132111
    133112        // not resuming self ?
     
    140119                // set last resumer
    141120                dst->last = src;
    142         }
     121        } // if
    143122
    144123        // always done for performance testing
Note: See TracChangeset for help on using the changeset viewer.