Changeset a97b9ed for libcfa/src/concurrency/cofor.cfa
- 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.cfa
r946a6e4 ra97b9ed 4 4 // cofor ( uC++ COFOR ) 5 5 6 thread co _runner {6 thread cofor_runner { 7 7 ssize_t low, high; 8 8 __cofor_body_t loop_body; 9 9 }; 10 10 11 static void ?{}( co _runner & this, ssize_t low, ssize_t high, __cofor_body_t loop_body ) {11 static void ?{}( cofor_runner & this, ssize_t low, ssize_t high, __cofor_body_t loop_body ) { 12 12 this.low = low; 13 13 this.high = high; … … 15 15 } 16 16 17 void main( co _runner & this ) with( this ) {17 void main( cofor_runner & this ) with( this ) { 18 18 for ( ssize_t i = low; i < high; i++ ) 19 19 loop_body(i); … … 29 29 ssize_t i = 0; 30 30 ssize_t stride_iter = low; 31 co _runner * runners[ threads ];31 cofor_runner * runners[ threads ]; 32 32 for ( i; threads ) { 33 33 runners[i] = alloc(); … … 45 45 } 46 46 47 //////////////////////////////////////////////////////////////////////////////////////////48 // parallel (COBEGIN/COEND)49 47 50 thread para_runner {51 parallel_stmt_t body;52 void * arg;53 };54 55 static void ?{}( para_runner & this, parallel_stmt_t body, void * arg ) {56 this.body = body;57 this.arg = arg;58 }59 60 void main( para_runner & this ) with( this ) { body( arg ); }61 62 void parallel( parallel_stmt_t * stmts, void ** args, size_t num ) libcfa_public {63 para_runner * runners[ num ];64 for ( i; num )65 (*(runners[i] = malloc())){ stmts[i], args[i] };66 for ( i; num )67 delete( runners[i] );68 }69
Note: See TracChangeset
for help on using the changeset viewer.