Changeset bf55f32


Ignore:
Timestamp:
Jul 17, 2023, 3:59:29 PM (9 months ago)
Author:
caparsons <caparson@…>
Branches:
master
Children:
5adb277
Parents:
1d66a91
Message:

added support for general channel operators

Location:
libcfa/src
Files:
5 edited

Legend:

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

    r1d66a91 rbf55f32  
    6363bool unregister_select( blocking_lock & this, select_node & node ) OPTIONAL_THREAD;
    6464bool on_selected( blocking_lock & this, select_node & node ) OPTIONAL_THREAD;
     65blocking_lock __CFA_select_get_type( blocking_lock this ) OPTIONAL_THREAD;
    6566
    6667//----------
     
    8182static inline bool   unregister_select( multiple_acquisition_lock & this, select_node & node ) { return unregister_select( (blocking_lock &)this, node ); }
    8283static inline bool   on_selected( multiple_acquisition_lock & this, select_node & node ) { return on_selected( (blocking_lock &)this, node ); }
     84multiple_acquisition_lock __CFA_select_get_type( multiple_acquisition_lock this );
  • libcfa/src/concurrency/channel.hfa

    r1d66a91 rbf55f32  
    330330///////////////////////////////////////////////////////////////////////////////////////////
    331331
    332 // static inline void ?>>?( T elem, channel(T) & chan ) { insert( chan, elem ); }
    333 // static inline void ?<<?( T & ret, channel(T) & chan ) { ret = remove( chan ); }
     332static inline void ?>>?( T elem, channel(T) & chan ) { insert( chan, elem ); }
     333static inline void ?<<?( T & ret, channel(T) & chan ) { ret = remove( chan ); }
    334334
    335335///////////////////////////////////////////////////////////////////////////////////////////
     
    372372    channel(T) & chan;
    373373};
     374__CFA_SELECT_GET_TYPE( chan_read(T) );
    374375
    375376static inline void ?{}( chan_read(T) & cr, channel(T) & chan, T & ret ) {
     
    464465    channel(T) & chan;
    465466};
     467__CFA_SELECT_GET_TYPE( chan_write(T) );
    466468
    467469static inline void ?{}( chan_write(T) & cw, channel(T) & chan, T elem ) {
  • libcfa/src/concurrency/future.hfa

    r1d66a91 rbf55f32  
    3939        futex_mutex lock;
    4040        };
     41    __CFA_SELECT_GET_TYPE( future(T) );
    4142
    4243    struct future_node {
  • libcfa/src/concurrency/locks.hfa

    r1d66a91 rbf55f32  
    113113static inline bool   unregister_select( single_acquisition_lock & this, select_node & node ) { return unregister_select( (blocking_lock &)this, node ); }
    114114static inline bool   on_selected( single_acquisition_lock & this, select_node & node ) { return on_selected( (blocking_lock &)this, node ); }
     115__CFA_SELECT_GET_TYPE( single_acquisition_lock );
    115116
    116117//----------
     
    130131static inline bool   unregister_select( owner_lock & this, select_node & node ) { return unregister_select( (blocking_lock &)this, node ); }
    131132static inline bool   on_selected( owner_lock & this, select_node & node ) { return on_selected( (blocking_lock &)this, node ); }
     133__CFA_SELECT_GET_TYPE( owner_lock );
    132134
    133135//-----------------------------------------------------------------------------
     
    620622
    621623static inline bool on_selected( simple_owner_lock & this, select_node & node ) { return true; }
    622 
     624__CFA_SELECT_GET_TYPE( simple_owner_lock );
    623625
    624626//-----------------------------------------------------------------------------
  • libcfa/src/concurrency/select.hfa

    r1d66a91 rbf55f32  
    9494
    9595    // This routine is run on the selecting thread prior to executing the statement corresponding to the select_node
    96     //    passed as an arg to this routine
    97     // If on_selected returns false, the statement is not run if the on_selected call occured as
    98     //    part of a statement block that only ran due to an unregister_select that returned true
    99     //    In all other executions the return value is ignored.
     96    //    passed as an arg to this routine. If true is returned proceed as normal, if false is returned the statement is skipped
    10097    bool on_selected( T &, select_node & );
    10198};
     99// Used inside the compiler to allow for overloading on return type for operations such as '?<<?' for channels
     100// YOU MUST USE THIS MACRO OR INCLUDE AN EQUIVALENT DECL FOR YOUR TYPE TO SUPPORT WAITUNTIL
     101#define __CFA_SELECT_GET_TYPE( typename ) typename __CFA_select_get_type( typename __CFA_t )
     102
    102103
    103104//=============================================================================================
     
    211212bool unregister_select( select_timeout_node & this, select_node & node );
    212213bool on_selected( select_timeout_node & this, select_node & node );
     214select_timeout_node __CFA_select_get_type( select_timeout_node this );
    213215
    214216// Gateway routines to waituntil on duration
    215217select_timeout_node timeout( Duration duration );
    216218select_timeout_node sleep( Duration duration );
     219
Note: See TracChangeset for help on using the changeset viewer.