csp::common::ChannelPoisoner< CHANNEL_END_TYPE > Class Template Reference

Inheritance diagram for csp::common::ChannelPoisoner< CHANNEL_END_TYPE >:

csp::CSProcess csp::ThreadCSProcess boost::noncopyable List of all members.

Detailed Description

template<typename CHANNEL_END_TYPE>
class csp::common::ChannelPoisoner< CHANNEL_END_TYPE >

Poisons the end of a channel and then exits.

It is typically used in sequence with another process using the same channel, so that once the previous process has finished, a channel it uses will be poisoned. For example:

        //Assuming out is some Chanout<int> we have:
        Run(InSequenceOneThread
            (new WriterProcess<int>(out,1,7) ) //Send the value "1" 7 times
            (new ChannelPoisoner< Chanout<int> >(out) ) //Then poison the channel
        );  

To use this process, you will need to include <cppcsp/common/basic.h>

DATA_TYPE Requirements

CHANNEL_END_TYPE must have a copy constructor, and must have a poison() method. In practice, this means CHANNEL_END_TYPE will usually be either Chanin or Chanout (AltChanin is also possible, but would have the same effect as using Chanin)


Public Member Functions

 ChannelPoisoner (const CHANNEL_END_TYPE &_end)
 Constructs the process.

Protected Member Functions

void run ()
 You must implement this function to provide the code for your process.


Constructor & Destructor Documentation

template<typename CHANNEL_END_TYPE>
csp::common::ChannelPoisoner< CHANNEL_END_TYPE >::ChannelPoisoner ( const CHANNEL_END_TYPE &  _end  )  [inline]

Constructs the process.

Parameters:
_end The channel end to poison


Member Function Documentation

template<typename CHANNEL_END_TYPE>
void csp::common::ChannelPoisoner< CHANNEL_END_TYPE >::run (  )  [inline, protected, virtual]

You must implement this function to provide the code for your process.

When the run method finishes, the process will terminate.

You should not let an uncaught exception cause the end of this function. If it derives from std::exception, it will be caught (although this behaviour should not be relied upon) but otherwise undefined behaviour will result.

Implements csp::ThreadCSProcess.


Generated on Mon Aug 20 12:24:29 2007 for C++CSP2 by  doxygen 1.4.7