ChannelGroup Class Reference

ChannelGroups are used to receive messages from multiple channels simultaneously. More...

#include <channel_decls.h>

List of all members.

Public Member Functions

 ChannelGroup (ChannelManager &m)
 ChannelGroup constructor.
void addChannel (BaseChannel &chan)
 Adds given channel to this group.
void removeChannel (BaseChannel &chan)
 Removes given channel from this group.
BaseChanneltryselect () const
 Tries to find a channel where messages are available.
BaseChannelselect () const
 Blockingly finds a channel where messages are available.


Detailed Description

ChannelGroups are used to receive messages from multiple channels simultaneously.

Channels can be added and removed to and from a group using addChannel() and removeChannel(). The methods select() and tryselect() can be used to find a channel with pending messages. A group may only be used by exactly one microthread.


Constructor & Destructor Documentation

ChannelGroup::ChannelGroup ( ChannelManager m  )  [inline]

ChannelGroup constructor.

Parameters:
m is the manager to register with.


Member Function Documentation

void ChannelGroup::addChannel ( BaseChannel chan  ) 

Adds given channel to this group.

A tryselect() or select() will then take this channel into account.

Parameters:
chan is the channel to add

void ChannelGroup::removeChannel ( BaseChannel chan  ) 

Removes given channel from this group.

A tryselect() or select() will no longer respond to messages on this channel.

Parameters:
chan is the channel to remove

BaseChannel * ChannelGroup::tryselect (  )  const

Tries to find a channel where messages are available.

It is guarantueed that two messages arriving on one channel are selected chronologically. It is furthermore guaranteed that two messages sent on two channels within this group are selected chronologically. This only takes message arrival into account. If two microthreads try to concurrently send messages to channels the one wining the lock of the manager will be first.

Returns:
a pointer to the selected channel if a message is available and NULL otherwise

BaseChannel & ChannelGroup::select (  )  const

Blockingly finds a channel where messages are available.

Please read the docs about tryselect(). If there are no messages available the current microthread is suspended until messages are available.

Returns:
a reference to the selected channel


The documentation for this class was generated from the following files:
Generated on Sat Feb 7 01:26:51 2009 by  doxygen 1.5.1