IrisArbiter

IrisArbiter — Message passing arbiters

Synopsis

                    IrisArbiter;
IrisReceiver*       iris_arbiter_receive                (IrisScheduler *scheduler,
                                                         IrisPort *port,
                                                         IrisMessageHandler handler,
                                                         gpointer user_data,
                                                         GDestroyNotify notify);
IrisArbiter*        iris_arbiter_coordinate             (IrisReceiver *exclusive,
                                                         IrisReceiver *concurrent,
                                                         IrisReceiver *teardown);

Object Hierarchy

  GObject
   +----IrisArbiter
         +----IrisCoordinationArbiter

Description

IrisArbiter provides a way to control how messages can be received. The simple arbiter, created using iris_arbiter_receive() does nothing to control when messages can be received. Messages will be processed as fast as the scheduler can handle them.

Alternatively, the coordination-arbiter can be used with iris_arbiter_coordinate(). The coordination-arbiter is similar to a reader-writer lock implemented asynchronously.

Details

IrisArbiter

typedef struct _IrisArbiter IrisArbiter;


iris_arbiter_receive ()

IrisReceiver*       iris_arbiter_receive                (IrisScheduler *scheduler,
                                                         IrisPort *port,
                                                         IrisMessageHandler handler,
                                                         gpointer user_data,
                                                         GDestroyNotify notify);

Creates a new IrisReceiver instance that executes callback when a message is received on the receiver. Note that if you attach this to an arbiter, a message posted to port may not result in callback being executed right away.

If not NULL, notify will be called when the receiver is destroyed.

scheduler :

An IrisScheduler or NULL

port :

An IrisPort

handler :

user_data :

data for callback

notify :

A GDestroyNotify or NULL

Returns :

the newly created IrisReceiver instance

iris_arbiter_coordinate ()

IrisArbiter*        iris_arbiter_coordinate             (IrisReceiver *exclusive,
                                                         IrisReceiver *concurrent,
                                                         IrisReceiver *teardown);

Coordinates messages incoming to the receivers. This is used to guarantee semantics for the receivers.

Any message received on the exclusive receiver is guaranteed to be the only message received at a time. No other exclusive, concurrent, or teardown messages will be running.

Messages received on the concurrent receiver can be received concurrently meaning more than one message is allowed to be received at a time.

Only one message can be recieved on teardown ever. After a message has been received on teardown, no further messages will ever be received on any receivers.

exclusive :

An IrisReceiver

concurrent :

An IrisReceiver

teardown :

An IrisReceiver

Returns :

An new IrisArbiter that will arbitrate messages incoming to the passed receivers.