Changeset 70a4ed5 for libcfa


Ignore:
Timestamp:
Jun 1, 2023, 11:55:09 AM (11 months ago)
Author:
caparsons <caparson@…>
Branches:
ast-experimental, master
Children:
fc0996a
Parents:
8913de4
Message:

refactored to remove return val from on_selected

Location:
libcfa/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bits/weakso_locks.cfa

    r8913de4 r70a4ed5  
    3030bool register_select( blocking_lock & this, select_node & node ) { return false; }
    3131bool unregister_select( blocking_lock & this, select_node & node ) { return false; }
    32 bool on_selected( blocking_lock & this, select_node & node ) { return true; }
     32void on_selected( blocking_lock & this, select_node & node ) {}
    3333
  • libcfa/src/concurrency/channel.hfa

    r8913de4 r70a4ed5  
    423423}
    424424static inline bool unregister_select( chan_read(T) & this, select_node & node ) { return unregister_chan( this.chan, node ); }
    425 static inline bool on_selected( chan_read(T) & this, select_node & node ) with(this) {
     425static inline void on_selected( chan_read(T) & this, select_node & node ) with(this) {
    426426    if ( node.extra == 0p ) // check if woken up due to closed channel
    427427        __closed_remove( chan, ret );
    428428    // This is only reachable if not closed or closed exception was handled
    429     return true;
    430429}
    431430
     
    515514static inline bool unregister_select( chan_write(T) & this, select_node & node ) { return unregister_chan( this.chan, node ); }
    516515
    517 static inline bool on_selected( chan_write(T) & this, select_node & node ) with(this) {
     516static inline void on_selected( chan_write(T) & this, select_node & node ) with(this) {
    518517    if ( node.extra == 0p ) // check if woken up due to closed channel
    519518        __closed_insert( chan, elem );
    520519
    521520    // This is only reachable if not closed or closed exception was handled
    522     return true;
    523521}
    524522
  • libcfa/src/concurrency/future.hfa

    r8913de4 r70a4ed5  
    7070                // check if the future is available
    7171        // currently no mutual exclusion because I can't see when you need this call to be synchronous or protected
    72                 bool available( future(T) & this ) { return this.state; }
     72                bool available( future(T) & this ) { return __atomic_load_n( &this.state, __ATOMIC_RELAXED ); }
    7373
    7474
     
    180180        }
    181181               
    182         bool on_selected( future(T) & this, select_node & node ) { return true; }
     182        void on_selected( future(T) & this, select_node & node ) {}
    183183        }
    184184}
    185185
    186186//--------------------------------------------------------------------------------------------------------
    187 // These futures below do not support select statements so they may not be as useful as 'future'
     187// These futures below do not support select statements so they may not have as many features as 'future'
    188188//  however the 'single_future' is cheap and cheerful and is most likely more performant than 'future'
    189189//  since it uses raw atomics and no locks
  • libcfa/src/concurrency/locks.cfa

    r8913de4 r70a4ed5  
    239239}
    240240
    241 bool on_selected( blocking_lock & this, select_node & node ) { return true; }
     241void on_selected( blocking_lock & this, select_node & node ) {}
    242242
    243243//-----------------------------------------------------------------------------
  • libcfa/src/concurrency/locks.hfa

    r8913de4 r70a4ed5  
    114114static inline bool   register_select( single_acquisition_lock & this, select_node & node ) { return register_select( (blocking_lock &)this, node ); }
    115115static inline bool   unregister_select( single_acquisition_lock & this, select_node & node ) { return unregister_select( (blocking_lock &)this, node ); }
    116 static inline bool   on_selected( single_acquisition_lock & this, select_node & node ) { return on_selected( (blocking_lock &)this, node ); }
     116static inline void   on_selected( single_acquisition_lock & this, select_node & node ) { on_selected( (blocking_lock &)this, node ); }
    117117
    118118//----------
     
    131131static inline bool   register_select( owner_lock & this, select_node & node ) { return register_select( (blocking_lock &)this, node ); }
    132132static inline bool   unregister_select( owner_lock & this, select_node & node ) { return unregister_select( (blocking_lock &)this, node ); }
    133 static inline bool   on_selected( owner_lock & this, select_node & node ) { return on_selected( (blocking_lock &)this, node ); }
     133static inline void   on_selected( owner_lock & this, select_node & node ) { on_selected( (blocking_lock &)this, node ); }
    134134
    135135//-----------------------------------------------------------------------------
     
    621621}
    622622
    623 static inline bool on_selected( simple_owner_lock & this, select_node & node ) { return true; }
     623static inline void on_selected( simple_owner_lock & this, select_node & node ) {}
    624624
    625625
  • libcfa/src/concurrency/select.cfa

    r8913de4 r70a4ed5  
    4949    return false;
    5050}
    51 bool on_selected( select_timeout_node & this, select_node & node ) { return true; }
     51void on_selected( select_timeout_node & this, select_node & node ) {}
    5252
    5353// Gateway routine to wait on duration
  • libcfa/src/concurrency/select.hfa

    r8913de4 r70a4ed5  
    9191    // For unregistering a select stmt on a selectable concurrency primitive
    9292    // 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 & );
    9494
    9595    // This routine is run on the selecting thread prior to executing the statement corresponding to the select_node
    9696    //    passed as an arg to this routine
    9797    // If on_selected returns false, the statement is not run, if it returns true it is run.
    98     bool on_selected( T &, select_node & );
     98    void on_selected( T &, select_node & );
    9999};
    100100
     
    188188bool register_select( select_timeout_node & this, select_node & node );
    189189bool unregister_select( select_timeout_node & this, select_node & node );
    190 bool on_selected( select_timeout_node & this, select_node & node );
     190void on_selected( select_timeout_node & this, select_node & node );
    191191
    192192// Gateway routines to waituntil on duration
Note: See TracChangeset for help on using the changeset viewer.