Ignore:
Timestamp:
Jan 13, 2023, 12:49:52 PM (23 months ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
b3d794fc, d61d034
Parents:
862658a
Message:

fixed termination synchronization in the channel benchmark to get rid of deadlock case

File:
1 edited

Legend:

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

    r862658a r42b739d7  
    3535static inline void ?{}( channel(T) &c ){ ((channel(T) &)c){ 0 }; }
    3636static inline void ^?{}( channel(T) &c ) with(c) { delete( buffer ); }
    37 inline size_t get_count( channel(T) & chan ) with(chan) { return count; }
    38 inline size_t get_size( channel(T) & chan ) with(chan) { return size; }
     37static inline size_t get_count( channel(T) & chan ) with(chan) { return count; }
     38static inline size_t get_size( channel(T) & chan ) with(chan) { return size; }
     39static inline bool has_waiters( channel(T) & chan ) with(chan) { return !empty( cons ) || !empty( prods ); }
     40static inline bool has_waiting_consumers( channel(T) & chan ) with(chan) { return !empty( cons ); }
     41static inline bool has_waiting_producers( channel(T) & chan ) with(chan) { return !empty( prods ); }
    3942
    40 inline void insert_( channel(T) & chan, T elem ) with(chan) {
     43static inline void insert_( channel(T) & chan, T elem ) with(chan) {
    4144    memcpy((void *)&buffer[back], (void *)&elem, sizeof(T));
    4245    count += 1;
     
    4649
    4750
    48 inline void insert( channel(T) & chan, T elem ) with(chan) {
     51static inline void insert( channel(T) & chan, T elem ) with(chan) {
    4952    lock( mutex_lock );
    5053
     
    7275}
    7376
    74 inline T remove( channel(T) & chan ) with(chan) {
     77static inline T remove( channel(T) & chan ) with(chan) {
    7578    lock( mutex_lock );
    7679    T retval;
Note: See TracChangeset for help on using the changeset viewer.