Motr  M0
m0_clink Struct Reference

#include <chan.h>

Collaboration diagram for m0_clink:
Collaboration graph

Data Fields

struct m0_chancl_chan
 
m0_chan_cb_t cl_cb
 
struct m0_clinkcl_group
 
struct m0_tlink cl_linkage
 
struct m0_semaphore cl_wait
 
bool cl_is_oneshot
 
uint64_t cl_magic
 

Detailed Description

A record of interest in events on a stream.

A clink records the appearance of events in the stream.

There are two ways to use a clink:

  • an asynchronous call-back can be specified as an argument to clink constructor m0_clink_init(). This call-back is called when an event happens in the channel the clink is registered with. It is guaranteed that a call-back is executed in the same context where event producer declared new event. A per-channel mutex m0_chan::ch_guard is held while call-backs are executed (except the case when m0_clink_signal() is used by producer).
  • once a clink is registered with a channel, it is possible to wait until an event happens by calling m0_chan_wait().

See the "Filtered wake-ups" section in the top-level comment on how to combine call-backs with waiting.

Concurrency control

A user must guarantee that at most one thread waits on a clink. Synchronization between call-backs, waits and clink destruction is also up to user.

A user owns a clink before call to m0_clink_add() and after return from the m0_clink_del() call. At any other time clink can be concurrently accessed by the implementation.

Liveness

A user is free to dispose a clink whenever it owns the latter.

Definition at line 274 of file chan.h.

Field Documentation

◆ cl_cb

m0_chan_cb_t cl_cb

Call-back to be called when event is declared.

Definition at line 278 of file chan.h.

◆ cl_chan

struct m0_chan* cl_chan

Channel this clink is registered with.

Definition at line 276 of file chan.h.

◆ cl_group

struct m0_clink* cl_group

The head of the clink group.

Definition at line 280 of file chan.h.

◆ cl_is_oneshot

bool cl_is_oneshot

Definition at line 284 of file chan.h.

◆ cl_linkage

struct m0_tlink cl_linkage

Linkage into m0_chan::ch_links

Definition at line 282 of file chan.h.

◆ cl_magic

uint64_t cl_magic

Definition at line 285 of file chan.h.

◆ cl_wait

struct m0_semaphore cl_wait

Definition at line 283 of file chan.h.


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