Changeset a97b9ed for libcfa/src/concurrency/cofor.hfa
- Timestamp:
- Oct 16, 2023, 8:09:51 AM (14 months ago)
- Branches:
- master
- Children:
- 2bf46a5, 54e59dd, 61e5d99
- Parents:
- 946a6e4 (diff), 8cbe732 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/cofor.hfa
r946a6e4 ra97b9ed 16 16 17 17 ////////////////////////////////////////////////////////////////////////////////////////// 18 // parallel (COBEGIN/COEND) 19 typedef void (*parallel_stmt_t)( void * ); 18 // corun 20 19 21 void parallel( parallel_stmt_t * stmts, void ** args, size_t num ); 20 // 21 typedef void (*__CFA_corun_lambda_t)( void ); 22 23 // used to run a corun statement in parallel 24 thread co_runner { 25 __CFA_corun_lambda_t body; 26 }; 27 28 // wraps a co_runner to provide RAII deallocation 29 struct runner_block { 30 co_runner * runner; 31 }; 32 static inline void ?{}( co_runner & this, __CFA_corun_lambda_t body ) { this.body = body; } 33 34 void main( co_runner & this ) with( this ) { body(); } 35 36 static inline void ?{}( runner_block & this ) {} 37 static inline void ?{}( runner_block & this, __CFA_corun_lambda_t body ) { 38 (*(this.runner = malloc())){ body }; 39 } 40 41 static inline void ^?{}( runner_block & this ) { 42 delete( this.runner ); 43 } 44
Note: See TracChangeset
for help on using the changeset viewer.