Motr  M0
m0_chan Struct Reference

#include <chan.h>

Collaboration diagram for m0_chan:
Collaboration graph

Data Fields

struct m0_mutexch_guard
 
struct m0_tl ch_links
 
uint32_t ch_waiters
 
struct m0_chan_addb2ch_addb2
 

Detailed Description

A stream of asynchronous events.

Concurrency control

There are three groups of channel functions with different serialization requirements:

  • (A) caller holds the ch_guard lock:
     m0_clink_add(),
     m0_clink_del(),
     m0_chan_signal(),
     m0_chan_broadcast(),
     m0_chan_fini();
    
    The implementation checks that the channel lock is held.
    
  • (B) caller does not hold the ch_guard lock:
     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.
    
  • (C) caller may hold the ch_guard lock:
     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

m0_chan_invariant()

Definition at line 229 of file chan.h.

Field Documentation

◆ ch_addb2

struct m0_chan_addb2* ch_addb2

Definition at line 237 of file chan.h.

◆ ch_guard

struct m0_mutex* ch_guard

Protecting lock, should be provided by user.

Definition at line 231 of file chan.h.

◆ ch_links

struct m0_tl ch_links

List of registered clinks.

Definition at line 233 of file chan.h.

◆ ch_waiters

uint32_t ch_waiters

Number of clinks in m0_chan::ch_links. This is used to speed up m0_chan_broadcast().

Definition at line 236 of file chan.h.


The documentation for this struct was generated from the following file: