Ignore:
Timestamp:
Jun 10, 2022, 2:59:53 PM (23 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
10ba012
Parents:
1c56bf7
Message:

Fixed wait_any to be polymorphic on future type.

Location:
libcfa/src/concurrency
Files:
2 edited

Legend:

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

    r1c56bf7 rf3da205  
    7676        void reset    ( io_future_t & this ) { return reset    (this.self); }
    7777        bool available( io_future_t & this ) { return available(this.self); }
     78        bool setup    ( io_future_t & this, oneshot & ctx ) { return setup  (this.self, ctx); }
     79        bool retract  ( io_future_t & this, oneshot & ctx ) { return retract(this.self, ctx); }
    7880}
    7981
  • libcfa/src/concurrency/kernel/fwd.hfa

    r1c56bf7 rf3da205  
    383383
    384384                        // Wait for any future to be fulfilled
    385                         future_t & wait_any( future_t * futures, size_t num_futures ) {
     385                        forall(T& | sized(T) | { bool setup( T&, oneshot & ); bool retract( T&, oneshot & ); })
     386                        T & wait_any( T * futures, size_t num_futures ) {
    386387                                oneshot temp;
    387388
     
    391392                                        if( !setup(futures[i], temp) ) return futures[i];
    392393                                }
    393                                
     394
    394395                                // Wait context is setup, just wait on it
    395396                                wait( temp );
    396                                
     397
    397398                                size_t ret;
    398399                                // attempt to retract all futures
     
    400401                                        if ( retract( futures[i], temp ) ) ret = i;
    401402                                }
    402                                
     403
    403404                                return futures[ret];
    404405                        }
Note: See TracChangeset for help on using the changeset viewer.