Motr
M0
|
#include <chan.h>
Data Fields | |
struct m0_mutex * | ch_guard |
struct m0_tl | ch_links |
uint32_t | ch_waiters |
struct m0_chan_addb2 * | ch_addb2 |
A stream of asynchronous events.
Concurrency control
There are three groups of channel functions with different serialization requirements:
m0_clink_add(), m0_clink_del(), m0_chan_signal(), m0_chan_broadcast(), m0_chan_fini(); The implementation checks that the channel lock is held.
m0_clink_add_lock(), m0_clink_del_lock(), m0_chan_signal_lock(), m0_chan_broadcast_lock(), m0_chan_fini_lock(); The implementation checks that the channel lock is not held.
m0_clink_init(), m0_clink_fini(), m0_clink_attach(), m0_clink_is_armed(), m0_clink_signal() (note this lock-tolerant signalling facility!), m0_chan_init(), m0_chan_wait(), m0_chan_trywait(), m0_chan_timedwait(). Nothing is assumed by the implementation about the channel lock.
Liveness
A user has to enforce a serialization between event production and channel destruction.
Invariants
struct m0_chan_addb2* ch_addb2 |
struct m0_mutex* ch_guard |
uint32_t ch_waiters |
Number of clinks in m0_chan::ch_links. This is used to speed up m0_chan_broadcast().