Changeset c0ec8b6 for libcfa/src/concurrency
- Timestamp:
- May 15, 2023, 1:15:43 PM (21 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- e23b3ce
- Parents:
- 629c95a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/future.hfa
r629c95a rc0ec8b6 52 52 } 53 53 54 void ?{}( future(T) & this) {54 void ?{}( future(T) & this ) { 55 55 this.waiters{}; 56 56 this.state = FUTURE_EMPTY; … … 59 59 60 60 // Reset future back to original state 61 void reset( future(T) & this) with(this)61 void reset( future(T) & this ) with(this) 62 62 { 63 63 lock( lock ); … … 85 85 select_node &s = try_pop_front( waiters ); 86 86 87 if ( s.clause_status == 0p ) 88 // poke in result so that woken threads do not need to reacquire any locks 87 if ( s.clause_status == 0p ) // poke in result so that woken threads do not need to reacquire any locks 89 88 copy_T( result, *(((future_node(T) &)s).my_result) ); 90 else if ( !__make_select_node_available( s ) ) continue;91 89 92 // only unpark if future is not selected 93 // or if it is selected we only unpark if we win the race 94 unpark( s.blocked_thread ); 90 wake_one( waiters, s ); 95 91 } 96 92 }
Note: See TracChangeset
for help on using the changeset viewer.