Changeset 42b739d7 for libcfa/src/concurrency/channel.hfa
- Timestamp:
- Jan 13, 2023, 12:49:52 PM (19 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- b3d794fc, d61d034
- Parents:
- 862658a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/channel.hfa
r862658a r42b739d7 35 35 static inline void ?{}( channel(T) &c ){ ((channel(T) &)c){ 0 }; } 36 36 static 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; } 37 static inline size_t get_count( channel(T) & chan ) with(chan) { return count; } 38 static inline size_t get_size( channel(T) & chan ) with(chan) { return size; } 39 static inline bool has_waiters( channel(T) & chan ) with(chan) { return !empty( cons ) || !empty( prods ); } 40 static inline bool has_waiting_consumers( channel(T) & chan ) with(chan) { return !empty( cons ); } 41 static inline bool has_waiting_producers( channel(T) & chan ) with(chan) { return !empty( prods ); } 39 42 40 inline void insert_( channel(T) & chan, T elem ) with(chan) {43 static inline void insert_( channel(T) & chan, T elem ) with(chan) { 41 44 memcpy((void *)&buffer[back], (void *)&elem, sizeof(T)); 42 45 count += 1; … … 46 49 47 50 48 inline void insert( channel(T) & chan, T elem ) with(chan) {51 static inline void insert( channel(T) & chan, T elem ) with(chan) { 49 52 lock( mutex_lock ); 50 53 … … 72 75 } 73 76 74 inline T remove( channel(T) & chan ) with(chan) {77 static inline T remove( channel(T) & chan ) with(chan) { 75 78 lock( mutex_lock ); 76 79 T retval;
Note: See TracChangeset
for help on using the changeset viewer.