Ignore:
Timestamp:
Oct 13, 2023, 7:13:21 PM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
a97b9ed, bab2917
Parents:
85034ed (diff), 0bf0b978 (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
  • libcfa/src/concurrency/cofor.hfa

    r85034ed r8cbe732  
    55typedef void (*__cofor_body_t)( ssize_t );
    66
    7 void cofor( ssize_t low, ssize_t high, __cofor_body_t loop_body );
     7void __Cofor__( ssize_t low, ssize_t high, __cofor_body_t loop_body );
    88
    99#define COFOR( lidname, low, high, loopbody ) \
     
    1212                        loopbody \
    1313                } \
    14                 cofor( low, high, __CFA_loopLambda__ ); \
     14                __Cofor__( low, high, __CFA_loopLambda__ ); \
    1515        }
    1616
    1717//////////////////////////////////////////////////////////////////////////////////////////
    18 // parallel (COBEGIN/COEND)
    19 typedef void (*parallel_stmt_t)( void * );
     18// corun
    2019
    21 void parallel( parallel_stmt_t * stmts, void ** args, size_t num );
     20//
     21typedef void (*__CFA_corun_lambda_t)( void );
     22
     23// used to run a corun statement in parallel
     24thread co_runner {
     25        __CFA_corun_lambda_t body;
     26};
     27
     28// wraps a co_runner to provide RAII deallocation
     29struct runner_block {
     30    co_runner * runner;
     31};
     32static inline void ?{}( co_runner & this, __CFA_corun_lambda_t body ) { this.body = body; }
     33
     34void main( co_runner & this ) with( this ) { body(); }
     35
     36static inline void ?{}( runner_block & this ) {}
     37static inline void ?{}( runner_block & this, __CFA_corun_lambda_t body ) {
     38    (*(this.runner = malloc())){ body };
     39}
     40
     41static inline void ^?{}( runner_block & this ) {
     42    delete( this.runner );
     43}
     44
Note: See TracChangeset for help on using the changeset viewer.