Changeset fbaea970
- Timestamp:
- Nov 23, 2025, 10:54:30 PM (3 hours ago)
- Branches:
- master
- Parents:
- 8ffee9a
- Files:
-
- 9 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) (5 diffs)
-
libcfa/src/concurrency/future.hfa (modified) (6 diffs)
-
libcfa/src/concurrency/locks.cfa (modified) (3 diffs)
-
libcfa/src/concurrency/locks.hfa (modified) (6 diffs)
-
libcfa/src/concurrency/select.cfa (modified) (3 diffs)
-
libcfa/src/concurrency/select.hfa (modified) (3 diffs)
-
src/Concurrency/Waituntil.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/weakso_locks.cfa
r8ffee9a rfbaea970 28 28 void on_wakeup( blocking_lock &, size_t ) {} 29 29 size_t wait_count( blocking_lock & ) { return 0; } 30 bool register_select ( blocking_lock & this, select_node & node ) { return false; }31 bool unregister_select ( blocking_lock & this, select_node & node ) { return false; }32 bool on_selected ( blocking_lock & this, select_node & node ) { return true; }30 bool register_select$( blocking_lock & this, select_node & node ) { return false; } 31 bool unregister_select$( blocking_lock & this, select_node & node ) { return false; } 32 bool on_selected$( blocking_lock & this, select_node & node ) { return true; } 33 33 -
libcfa/src/bits/weakso_locks.hfa
r8ffee9a rfbaea970 59 59 void on_wakeup( blocking_lock & this, size_t ) OPTIONAL_THREAD; 60 60 size_t wait_count( blocking_lock & this ) OPTIONAL_THREAD; 61 bool register_select ( blocking_lock & this, select_node & node ) OPTIONAL_THREAD;62 bool unregister_select ( blocking_lock & this, select_node & node ) OPTIONAL_THREAD;63 bool on_selected ( blocking_lock & this, select_node & node ) OPTIONAL_THREAD;61 bool register_select$( blocking_lock & this, select_node & node ) OPTIONAL_THREAD; 62 bool unregister_select$( blocking_lock & this, select_node & node ) OPTIONAL_THREAD; 63 bool on_selected$( blocking_lock & this, select_node & node ) OPTIONAL_THREAD; 64 64 blocking_lock __CFA_select_get_type( blocking_lock this ) OPTIONAL_THREAD; 65 65 … … 78 78 static inline void on_wakeup( multiple_acquisition_lock & this, size_t v ) { on_wakeup ( (blocking_lock &)this, v ); } 79 79 static inline void on_notify( multiple_acquisition_lock & this, struct thread$ * t ){ on_notify( (blocking_lock &)this, t ); } 80 static inline bool register_select ( multiple_acquisition_lock & this, select_node & node ) { return register_select( (blocking_lock &)this, node ); }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 ) { return on_selected( (blocking_lock &)this, node ); }80 static inline bool register_select$( multiple_acquisition_lock & this, select_node & node ) { return register_select$( (blocking_lock &)this, node ); } 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 ) { return on_selected$( (blocking_lock &)this, node ); } 83 83 multiple_acquisition_lock __CFA_select_get_type( multiple_acquisition_lock this ); -
libcfa/src/concurrency/channel.hfa
r8ffee9a rfbaea970 411 411 } 412 412 413 bool register_select ( chan_read(T) & this, select_node & node ) with(*this.chan, this) {413 bool register_select$( chan_read(T) & this, select_node & node ) with(*this.chan, this) { 414 414 lock( mutex_lock ); 415 415 node.extra = ret; // set .extra so that if it == 0p later in on_selected it is due to channel close … … 476 476 return true; 477 477 } 478 bool unregister_select ( chan_read(T) & this, select_node & node ) { return unregister_chan( *this.chan, node ); }479 bool on_selected ( chan_read(T) & this, select_node & node ) with(this) {478 bool unregister_select$( chan_read(T) & this, select_node & node ) { return unregister_chan( *this.chan, node ); } 479 bool on_selected$( chan_read(T) & this, select_node & node ) with(this) { 480 480 if ( unlikely(node.extra == 0p) ) { 481 481 if ( ! exception_in_flight() ) __closed_remove( *chan, *ret ); // check if woken up due to closed channel … … 491 491 492 492 chan_read_no_ret(T) remove( channel(T) & chan ) { chan_read_no_ret(T) c_read{ chan }; return c_read; } 493 bool register_select ( chan_read_no_ret(T) & this, select_node & node ) {493 bool register_select$( chan_read_no_ret(T) & this, select_node & node ) { 494 494 this.c_read.ret = &this.retval; 495 return register_select ( this.c_read, node );496 } 497 bool unregister_select ( chan_read_no_ret(T) & this, select_node & node ) { return unregister_select( this.c_read, node ); }498 bool on_selected ( chan_read_no_ret(T) & this, select_node & node ) { return on_selected( this.c_read, node ); }495 return register_select$( this.c_read, node ); 496 } 497 bool unregister_select$( chan_read_no_ret(T) & this, select_node & node ) { return unregister_select$( this.c_read, node ); } 498 bool on_selected$( chan_read_no_ret(T) & this, select_node & node ) { return on_selected$( this.c_read, node ); } 499 499 500 500 void ?{}( chan_write(T) & cw, channel(T) * chan, T elem ) { … … 511 511 } 512 512 513 bool register_select ( chan_write(T) & this, select_node & node ) with(*this.chan, this) {513 bool register_select$( chan_write(T) & this, select_node & node ) with(*this.chan, this) { 514 514 lock( mutex_lock ); 515 515 node.extra = &elem; // set .extra so that if it == 0p later in on_selected it is due to channel close … … 577 577 return true; 578 578 } 579 bool unregister_select ( chan_write(T) & this, select_node & node ) { return unregister_chan( *this.chan, node ); }580 581 bool on_selected ( chan_write(T) & this, select_node & node ) with(this) {579 bool unregister_select$( chan_write(T) & this, select_node & node ) { return unregister_chan( *this.chan, node ); } 580 581 bool on_selected$( chan_write(T) & this, select_node & node ) with(this) { 582 582 if ( unlikely(node.extra == 0p) ) { 583 583 if ( ! exception_in_flight() ) __closed_insert( *chan, elem ); // check if woken up due to closed channel -
libcfa/src/concurrency/future.hfa
r8ffee9a rfbaea970 10 10 // Created On : Wed Jan 06 17:33:18 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Nov 19 09:26:38 202513 // Update Count : 20 412 // Last Modified On : Sun Nov 23 22:48:08 2025 13 // Update Count : 208 14 14 // 15 15 … … 55 55 // PRIVATE 56 56 57 bool register_select ( future(T) & fut, select_node & s ) with( fut ) { // for waituntil statement57 bool register_select$( future(T) & fut, select_node & s ) with( fut ) { // for waituntil statement 58 58 lock( lock ); 59 59 … … 78 78 } 79 79 80 bool unregister_select ( future(T) & fut, select_node & s ) with( fut ) { // for waituntil statement80 bool unregister_select$( future(T) & fut, select_node & s ) with( fut ) { // for waituntil statement 81 81 if ( ! isListed( s ) ) return false; 82 82 lock( lock ); … … 86 86 } 87 87 88 bool on_selected ( future(T) &, select_node & ) { return true; } // for waituntil statement88 bool on_selected$( future(T) &, select_node & ) { return true; } // for waituntil statement 89 89 90 90 // PUBLIC … … 98 98 99 99 void ?{}( future(T) & fut ) with( fut ) { 100 // waiters{};101 100 except = 0p; 102 101 state = FUTURE_EMPTY$; … … 260 259 // PRIVATE 261 260 262 bool register_select ( future_rc(T) & frc, select_node & s ) with( frc ) { // for waituntil statement263 return register_select ( frc.impl->fut, s );264 } 265 266 bool unregister_select ( future_rc(T) & frc, select_node & s ) with( frc ) { // for waituntil statement267 return unregister_select ( frc.impl->fut, s );268 } 269 270 bool on_selected ( future_rc(T) &, select_node & ) { return true; } // for waituntil statement261 bool register_select$( future_rc(T) & frc, select_node & s ) with( frc ) { // for waituntil statement 262 return register_select$( frc.impl->fut, s ); 263 } 264 265 bool unregister_select$( future_rc(T) & frc, select_node & s ) with( frc ) { // for waituntil statement 266 return unregister_select$( frc.impl->fut, s ); 267 } 268 269 bool on_selected$( future_rc(T) &, select_node & ) { return true; } // for waituntil statement 271 270 272 271 // PUBLIC -
libcfa/src/concurrency/locks.cfa
r8ffee9a rfbaea970 186 186 187 187 // waituntil() support 188 bool register_select ( blocking_lock & this, select_node & node ) with(this) {188 bool register_select$( blocking_lock & this, select_node & node ) with(this) { 189 189 lock( lock __cfaabi_dbg_ctx2 ); 190 190 thread$ * thrd = active_thread(); … … 218 218 } 219 219 220 bool unregister_select ( blocking_lock & this, select_node & node ) with(this) {220 bool unregister_select$( blocking_lock & this, select_node & node ) with(this) { 221 221 lock( lock __cfaabi_dbg_ctx2 ); 222 222 if ( isListed( node ) ) { … … 239 239 } 240 240 241 bool on_selected ( blocking_lock & this, select_node & node ) { return true; }241 bool on_selected$( blocking_lock & this, select_node & node ) { return true; } 242 242 243 243 //----------------------------------------------------------------------------- -
libcfa/src/concurrency/locks.hfa
r8ffee9a rfbaea970 11 11 // Created On : Thu Jan 21 19:46:50 2021 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Mon Nov 17 20:48:55 202514 // Update Count : 6 313 // Last Modified On : Sun Nov 23 22:38:45 2025 14 // Update Count : 67 15 15 // 16 16 … … 127 127 static inline void on_wakeup( single_acquisition_lock & this, size_t v ) { on_wakeup ( (blocking_lock &)this, v ); } 128 128 static inline void on_notify( single_acquisition_lock & this, struct thread$ * t ) { on_notify( (blocking_lock &)this, t ); } 129 static inline bool register_select ( single_acquisition_lock & this, select_node & node ) { return register_select( (blocking_lock &)this, node ); }130 static inline bool unregister_select ( single_acquisition_lock & this, select_node & node ) { return unregister_select( (blocking_lock &)this, node ); }131 static inline bool on_selected ( single_acquisition_lock & this, select_node & node ) { return on_selected( (blocking_lock &)this, node ); }129 static inline bool register_select$( single_acquisition_lock & this, select_node & node ) { return register_select$( (blocking_lock &)this, node ); } 130 static inline bool unregister_select$( single_acquisition_lock & this, select_node & node ) { return unregister_select$( (blocking_lock &)this, node ); } 131 static inline bool on_selected$( single_acquisition_lock & this, select_node & node ) { return on_selected$( (blocking_lock &)this, node ); } 132 132 __CFA_SELECT_GET_TYPE( single_acquisition_lock ); 133 133 … … 145 145 static inline void on_wakeup( owner_lock & this, size_t v ) { on_wakeup ( (blocking_lock &)this, v ); } 146 146 static inline void on_notify( owner_lock & this, struct thread$ * t ) { on_notify( (blocking_lock &)this, t ); } 147 static inline bool register_select ( owner_lock & this, select_node & node ) { return register_select( (blocking_lock &)this, node ); }148 static inline bool unregister_select ( owner_lock & this, select_node & node ) { return unregister_select( (blocking_lock &)this, node ); }149 static inline bool on_selected ( owner_lock & this, select_node & node ) { return on_selected( (blocking_lock &)this, node ); }147 static inline bool register_select$( owner_lock & this, select_node & node ) { return register_select$( (blocking_lock &)this, node ); } 148 static inline bool unregister_select$( owner_lock & this, select_node & node ) { return unregister_select$( (blocking_lock &)this, node ); } 149 static inline bool on_selected$( owner_lock & this, select_node & node ) { return on_selected$( (blocking_lock &)this, node ); } 150 150 __CFA_SELECT_GET_TYPE( owner_lock ); 151 151 … … 611 611 612 612 // waituntil() support 613 static inline bool register_select ( simple_owner_lock & this, select_node & node ) with( this ) {613 static inline bool register_select$( simple_owner_lock & this, select_node & node ) with( this ) { 614 614 lock( lock __cfaabi_dbg_ctx2 ); 615 615 … … 643 643 } 644 644 645 static inline bool unregister_select ( simple_owner_lock & this, select_node & node ) with( this ) {645 static inline bool unregister_select$( simple_owner_lock & this, select_node & node ) with( this ) { 646 646 lock( lock __cfaabi_dbg_ctx2 ); 647 647 if ( isListed( node ) ) { … … 661 661 } 662 662 663 static inline bool on_selected ( simple_owner_lock & /*this*/, select_node & /*node*/ ) { return true; }663 static inline bool on_selected$( simple_owner_lock & /*this*/, select_node & /*node*/ ) { return true; } 664 664 __CFA_SELECT_GET_TYPE( simple_owner_lock ); 665 665 -
libcfa/src/concurrency/select.cfa
r8ffee9a rfbaea970 10 10 // Author : Colby Alexander Parsons 11 11 // Created On : Thu Apr 21 19:46:50 2023 12 // Last Modified By : Kyoung Seo13 // Last Modified On : Wed Mar 19 12:00:00202514 // Update Count : 112 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Sun Nov 23 22:38:53 2025 14 // Update Count : 4 15 15 // 16 16 … … 39 39 40 40 // Selectable trait routines 41 bool register_select ( select_timeout_node & this, select_node & node ) {41 bool register_select$( select_timeout_node & this, select_node & node ) { 42 42 this.s_node = &node; 43 43 node.extra = 0p; … … 45 45 return false; 46 46 } 47 bool unregister_select ( select_timeout_node & this, select_node & node ) {47 bool unregister_select$( select_timeout_node & this, select_node & node ) { 48 48 unregister_self( &this.a_node ); 49 49 return false; 50 50 } 51 bool on_selected ( select_timeout_node & this, select_node & node ) { return true; }51 bool on_selected$( select_timeout_node & this, select_node & node ) { return true; } 52 52 -
libcfa/src/concurrency/select.hfa
r8ffee9a rfbaea970 11 11 // Created On : Thu Jan 21 19:46:50 2023 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Fri Apr 25 07:31:26 202514 // Update Count : 513 // Last Modified On : Sun Nov 23 22:38:36 2025 14 // Update Count : 8 15 15 // 16 16 … … 87 87 // For registering a select stmt on a selectable concurrency primitive 88 88 // Returns bool that indicates if operation is already SAT 89 bool register_select ( T &, select_node & );89 bool register_select$( T &, select_node & ); 90 90 91 91 // For unregistering a select stmt on a selectable concurrency primitive 92 92 // If true is returned then the corresponding code block is run (only in non-special OR case and only if node status is not RUN) 93 bool unregister_select ( T &, select_node & );93 bool unregister_select$( T &, select_node & ); 94 94 95 95 // This routine is run on the selecting thread prior to executing the statement corresponding to the select_node 96 96 // passed as an arg to this routine. If true is returned proceed as normal, if false is returned the statement is skipped 97 bool on_selected ( T &, select_node & );97 bool on_selected$( T &, select_node & ); 98 98 }; 99 99 // Used inside the compiler to allow for overloading on return type for operations such as '?<<?' for channels … … 209 209 210 210 // Selectable trait routines 211 bool register_select ( select_timeout_node & this, select_node & node );212 bool unregister_select ( select_timeout_node & this, select_node & node );213 bool on_selected ( select_timeout_node & this, select_node & node );211 bool register_select$( select_timeout_node & this, select_node & node ); 212 bool unregister_select$( select_timeout_node & this, select_node & node ); 213 bool on_selected$( select_timeout_node & this, select_node & node ); 214 214 select_timeout_node __CFA_select_get_type( select_timeout_node this ); 215 215 -
src/Concurrency/Waituntil.cpp
r8ffee9a rfbaea970 9 9 // Author : Andrew Beach 10 10 // Created On : Fri May 27 10:31:00 2022 11 // Last Modified By : Andrew Beach12 // Last Modified On : Tue Jun 13 13:30:00 202213 // Update Count : 011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Nov 23 22:37:39 2025 13 // Update Count : 3 14 14 // 15 15 … … 606 606 607 607 // Generates: register_select(A, clause1); 608 currBody->push_back( new ExprStmt( loc, genSelectTraitCall( clause, data, "register_select " ) ) );608 currBody->push_back( new ExprStmt( loc, genSelectTraitCall( clause, data, "register_select$" ) ) ); 609 609 610 610 // generates: if ( when_cond ) { ... currBody ... } … … 638 638 { 639 639 new IfStmt( cLoc, 640 genSelectTraitCall( clause, data, "on_selected " ),640 genSelectTraitCall( clause, data, "on_selected$" ), 641 641 ast::deepCopy( clause->stmt ) 642 642 ) … … 715 715 ) 716 716 ), 717 new ExprStmt( loc, genSelectTraitCall( clause, clauseData.at(idx), "unregister_select " ) )717 new ExprStmt( loc, genSelectTraitCall( clause, clauseData.at(idx), "unregister_select$" ) ) 718 718 } 719 719 ) … … 1017 1017 const CodeLocation & cLoc = stmt->clauses.at(idx)->location; 1018 1018 1019 Expr * baseCond = genSelectTraitCall( stmt->clauses.at(idx), data.at(idx), "register_select " );1019 Expr * baseCond = genSelectTraitCall( stmt->clauses.at(idx), data.at(idx), "register_select$" ); 1020 1020 Expr * ifCond; 1021 1021 … … 1150 1150 new IfStmt( cLoc, 1151 1151 ifCond, 1152 new ExprStmt( cLoc, genSelectTraitCall( stmt->clauses.at(i), clauseData.at(i), "unregister_select " ) )1152 new ExprStmt( cLoc, genSelectTraitCall( stmt->clauses.at(i), clauseData.at(i), "unregister_select$" ) ) 1153 1153 ) 1154 1154 ); … … 1343 1343 ), 1344 1344 new CastExpr( cLoc, 1345 genSelectTraitCall( stmt->clauses.at(i), clauseData.at(i), "unregister_select " ),1345 genSelectTraitCall( stmt->clauses.at(i), clauseData.at(i), "unregister_select$" ), 1346 1346 new BasicType( BasicKind::Bool ), GeneratedFlag::ExplicitCast 1347 1347 ), … … 1372 1372 { 1373 1373 new IfStmt( cLoc, 1374 genSelectTraitCall( stmt->clauses.at(i), clauseData.at(i), "on_selected " ),1374 genSelectTraitCall( stmt->clauses.at(i), clauseData.at(i), "on_selected$" ), 1375 1375 ast::deepCopy( stmt->clauses.at(i)->stmt ) 1376 1376 )
Note:
See TracChangeset
for help on using the changeset viewer.