Changeset c0ec8b6 for libcfa/src


Ignore:
Timestamp:
May 15, 2023, 1:15:43 PM (13 months ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
e23b3ce
Parents:
629c95a
Message:

fixed bug in waituntil and future interop where signals could be lost

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/future.hfa

    r629c95a rc0ec8b6  
    5252        }
    5353
    54         void ?{}(future(T) & this) {
     54        void ?{}( future(T) & this ) {
    5555                        this.waiters{};
    5656            this.state = FUTURE_EMPTY;
     
    5959
    6060                // Reset future back to original state
    61                 void reset(future(T) & this) with(this)
     61                void reset( future(T) & this ) with(this)
    6262        {
    6363            lock( lock );
     
    8585                select_node &s = try_pop_front( waiters );
    8686
    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
    8988                    copy_T( result, *(((future_node(T) &)s).my_result) );
    90                 else if ( !__make_select_node_available( s ) ) continue;
    9189               
    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 );
    9591            }
    9692        }
Note: See TracChangeset for help on using the changeset viewer.