Changes in / [c16cc99:ffac259]
- Files:
-
- 2 deleted
- 12 edited
-
libcfa/src/bits/weakso_locks.cfa (modified) (1 diff)
-
libcfa/src/bits/weakso_locks.hfa (modified) (2 diffs)
-
libcfa/src/concurrency/channel.hfa (modified) (2 diffs)
-
libcfa/src/concurrency/future.hfa (modified) (1 diff)
-
libcfa/src/concurrency/invoke.h (modified) (1 diff)
-
libcfa/src/concurrency/kernel.cfa (modified) (1 diff)
-
libcfa/src/concurrency/locks.cfa (modified) (1 diff)
-
libcfa/src/concurrency/locks.hfa (modified) (3 diffs)
-
libcfa/src/concurrency/select.cfa (modified) (1 diff)
-
libcfa/src/concurrency/select.hfa (modified) (2 diffs)
-
src/Concurrency/Waituntil.cpp (modified) (2 diffs)
-
tests/concurrency/waituntil/.expect/repeat_close.txt (deleted)
-
tests/concurrency/waituntil/channel_close.cfa (modified) (2 diffs)
-
tests/concurrency/waituntil/repeat_close.cfa (deleted)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/weakso_locks.cfa
rc16cc99 rffac259 30 30 bool register_select( blocking_lock & this, select_node & node ) { return false; } 31 31 bool unregister_select( blocking_lock & this, select_node & node ) { return false; } 32 bool on_selected( blocking_lock & this, select_node & node ) { return true;}32 void on_selected( blocking_lock & this, select_node & node ) {} 33 33 -
libcfa/src/bits/weakso_locks.hfa
rc16cc99 rffac259 62 62 bool register_select( blocking_lock & this, select_node & node ) OPTIONAL_THREAD; 63 63 bool unregister_select( blocking_lock & this, select_node & node ) OPTIONAL_THREAD; 64 boolon_selected( blocking_lock & this, select_node & node ) OPTIONAL_THREAD;64 void on_selected( blocking_lock & this, select_node & node ) OPTIONAL_THREAD; 65 65 66 66 //---------- … … 80 80 static inline bool register_select( multiple_acquisition_lock & this, select_node & node ) { return register_select( (blocking_lock &)this, node ); } 81 81 static inline bool unregister_select( multiple_acquisition_lock & this, select_node & node ) { return unregister_select( (blocking_lock &)this, node ); } 82 static inline bool on_selected( multiple_acquisition_lock & this, select_node & node ) { returnon_selected( (blocking_lock &)this, node ); }82 static inline void on_selected( multiple_acquisition_lock & this, select_node & node ) { on_selected( (blocking_lock &)this, node ); } -
libcfa/src/concurrency/channel.hfa
rc16cc99 rffac259 444 444 } 445 445 static inline bool unregister_select( chan_read(T) & this, select_node & node ) { return unregister_chan( this.chan, node ); } 446 static inline bool on_selected( chan_read(T) & this, select_node & node ) with(this) { 447 if ( unlikely(node.extra == 0p) ) { 448 if ( !exception_in_flight() ) __closed_remove( chan, ret ); // check if woken up due to closed channel 449 else return false; 450 } 446 static inline void on_selected( chan_read(T) & this, select_node & node ) with(this) { 447 if ( node.extra == 0p ) // check if woken up due to closed channel 448 __closed_remove( chan, ret ); 451 449 // This is only reachable if not closed or closed exception was handled 452 return true;453 450 } 454 451 … … 539 536 static inline bool unregister_select( chan_write(T) & this, select_node & node ) { return unregister_chan( this.chan, node ); } 540 537 541 static inline bool on_selected( chan_write(T) & this, select_node & node ) with(this) { 542 if ( unlikely(node.extra == 0p) ) { 543 if ( !exception_in_flight() ) __closed_insert( chan, elem ); // check if woken up due to closed channel 544 else return false; 545 } 538 static inline void on_selected( chan_write(T) & this, select_node & node ) with(this) { 539 if ( node.extra == 0p ) // check if woken up due to closed channel 540 __closed_insert( chan, elem ); 541 546 542 // This is only reachable if not closed or closed exception was handled 547 return true;548 543 } 549 544 -
libcfa/src/concurrency/future.hfa
rc16cc99 rffac259 180 180 } 181 181 182 bool on_selected( future(T) & this, select_node & node ) { return true;}182 void on_selected( future(T) & this, select_node & node ) {} 183 183 } 184 184 } -
libcfa/src/concurrency/invoke.h
rc16cc99 rffac259 255 255 #ifdef __cforall 256 256 extern "Cforall" { 257 static inline bool exception_in_flight() {258 return __get_stack( &active_thread()->self_cor )->exception_context.current_exception != 0p;259 }260 261 257 static inline thread$ * volatile & ?`next ( thread$ * this ) { 262 258 return this->user_link.next; -
libcfa/src/concurrency/kernel.cfa
rc16cc99 rffac259 569 569 returnToKernel(); 570 570 __enable_interrupts_checked(); 571 571 572 } 572 573 -
libcfa/src/concurrency/locks.cfa
rc16cc99 rffac259 239 239 } 240 240 241 bool on_selected( blocking_lock & this, select_node & node ) { return true;}241 void on_selected( blocking_lock & this, select_node & node ) {} 242 242 243 243 //----------------------------------------------------------------------------- -
libcfa/src/concurrency/locks.hfa
rc16cc99 rffac259 112 112 static inline bool register_select( single_acquisition_lock & this, select_node & node ) { return register_select( (blocking_lock &)this, node ); } 113 113 static inline bool unregister_select( single_acquisition_lock & this, select_node & node ) { return unregister_select( (blocking_lock &)this, node ); } 114 static inline bool on_selected( single_acquisition_lock & this, select_node & node ) { returnon_selected( (blocking_lock &)this, node ); }114 static inline void on_selected( single_acquisition_lock & this, select_node & node ) { on_selected( (blocking_lock &)this, node ); } 115 115 116 116 //---------- … … 129 129 static inline bool register_select( owner_lock & this, select_node & node ) { return register_select( (blocking_lock &)this, node ); } 130 130 static inline bool unregister_select( owner_lock & this, select_node & node ) { return unregister_select( (blocking_lock &)this, node ); } 131 static inline bool on_selected( owner_lock & this, select_node & node ) { returnon_selected( (blocking_lock &)this, node ); }131 static inline void on_selected( owner_lock & this, select_node & node ) { on_selected( (blocking_lock &)this, node ); } 132 132 133 133 //----------------------------------------------------------------------------- … … 619 619 } 620 620 621 static inline bool on_selected( simple_owner_lock & this, select_node & node ) { return true;}621 static inline void on_selected( simple_owner_lock & this, select_node & node ) {} 622 622 623 623 -
libcfa/src/concurrency/select.cfa
rc16cc99 rffac259 49 49 return false; 50 50 } 51 bool on_selected( select_timeout_node & this, select_node & node ) { return true;}51 void on_selected( select_timeout_node & this, select_node & node ) {} 52 52 53 53 // Gateway routine to wait on duration -
libcfa/src/concurrency/select.hfa
rc16cc99 rffac259 96 96 // passed as an arg to this routine 97 97 // If on_selected returns false, the statement is not run, if it returns true it is run. 98 boolon_selected( T &, select_node & );98 void on_selected( T &, select_node & ); 99 99 }; 100 100 … … 208 208 bool register_select( select_timeout_node & this, select_node & node ); 209 209 bool unregister_select( select_timeout_node & this, select_node & node ); 210 boolon_selected( select_timeout_node & this, select_node & node );210 void on_selected( select_timeout_node & this, select_node & node ); 211 211 212 212 // Gateway routines to waituntil on duration -
src/Concurrency/Waituntil.cpp
rc16cc99 rffac259 1290 1290 // Collection of unregister calls on resources to be put in finally clause 1291 1291 // for each clause: 1292 // if ( !__CFA_has_clause_run( clause_statuses[i] )) && unregister_select( ... , clausei ) ) { ... clausei stmt ... }1292 // when_cond_i = (!__CFA_has_clause_run( clause_statuses[i] )) && unregister_select( ... , clausei ); 1293 1293 // OR if when( ... ) defined on resource 1294 // if ( when_cond_i && (!__CFA_has_clause_run( clause_statuses[i] )) && unregister_select( ... , clausei ) ) { ... clausei stmt ... } 1294 // if ( when_cond_i ) 1295 // when_cond_i = (!__CFA_has_clause_run( clause_statuses[i] )) && unregister_select( ... , clausei ); 1295 1296 CompoundStmt * unregisters = new CompoundStmt( loc ); 1297 1296 1298 1297 1299 Expr * statusExpr; // !__CFA_has_clause_run( clause_statuses[i] ) … … 1346 1348 new IfStmt( cLoc, 1347 1349 statusExpr, 1348 new CompoundStmt( cLoc, 1349 { 1350 new IfStmt( cLoc, 1351 genSelectTraitCall( stmt->clauses.at(i), clauseData.at(i), "on_selected" ), 1352 ast::deepCopy( stmt->clauses.at(i)->stmt ) 1353 ) 1354 } 1355 ) 1356 ) 1357 ); 1358 1359 // // generates: 1360 // // if ( statusExpr ) { ... clausei stmt ... } 1361 // unregisters->push_back( 1362 // new IfStmt( cLoc, 1363 // statusExpr, 1364 // genStmtBlock( stmt->clauses.at(i), clauseData.at(i) ) 1365 // ) 1366 // ); 1350 genStmtBlock( stmt->clauses.at(i), clauseData.at(i) ) 1351 ) 1352 ); 1367 1353 } 1368 1354 -
tests/concurrency/waituntil/channel_close.cfa
rc16cc99 rffac259 31 31 } 32 32 waituntil( (in << A) ) { assert( A_removes == in ); A_removes++; removes++; } 33 or waituntil( (in << B) ) { assert( B_removes == in); B_removes++; removes++; }33 or waituntil( (in2 << B) ) { assert( B_removes == in2 ); B_removes++; removes++; } 34 34 } 35 35 } catchResume ( channel_closed * e ) {} // continue to remove until would block … … 74 74 ^B{}; 75 75 76 useAnd = true;77 78 76 inserts = 0; 79 77 removes = 0;
Note:
See TracChangeset
for help on using the changeset viewer.