Skip to content
Snippets Groups Projects
Commit 34a7ec70 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Konstantin Osipov
Browse files

cbus: add pair/unpair helpers

This patch introduces cbus_pair() and cbus_unpair() helpers to
pair/unpair two existing cbus endpoints in one function call.

cbus_pair() creates pipes from the caller's cord to the given
destination and back. It blocks the caller until both pipes are
created. The caller may specify a callback to be called at the
destination right after the pipe to the source has been created,
which may be useful for preparing the destination to receiving
messages from the source.

cbus_unpair() initiates destruction of pipes created with cbus_pair()
and blocks the caller until destruction is complete. Since there may
be messages queued at the destination endpoint when this function is
called, before proceeding to pipe destruction this function flushes
all messages at the destination by sending an empty message from the
source to the destination and back. The caller may specify a callback
to be invoked by this message at the destination endpoint. This can
be used to notify the destination that the channel is about to be
destroyed and it must stop generating new messages.
parent 64aab50c
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment