csp Namespace Reference


Detailed Description

Namespace containing all the core C++CSP2 functionality.


Classes

class  AltChanin
 This class is identical to Chanin except that it also supports ALTing. More...
class  Alternative
 A class for performing ALTs. More...
class  Any2AnyChannel
 An any-to-any unbuffered channel. More...
class  Any2OneChannel
 An any-to-one unbuffered channel. More...
class  Barrier
 A barrier that multiple processes can synchronize on. More...
class  BarrierEnd
 The "end" of a barrier for use. More...
class  BarrierError
 An error that is thrown when the Barrier or BarrierEnd classes are mis-used. More...
class  BlackHoleChannel
 A "one-to-none" channel. More...
class  Bucket
 A bucket is a synchronisation primitive. More...
class  BufferedAny2AnyChannel
 An any-to-any buffered channel. More...
class  BufferedAny2OneChannel
 A any-to-one buffered channel. More...
class  BufferedChannelFactory
 An implementation of ChannelFactory for buffered channels. More...
class  BufferedOne2AnyChannel
 A one-to-any buffered channel. More...
class  BufferedOne2OneChannel
 A one-to-one buffered channel. More...
class  Chanin
 The reading end of a channel. More...
class  ChannelBuffer
 The base class for channel buffers. More...
class  ChannelBufferFactory
 The base class for all the channel buffer factories. More...
class  ChannelBufferFactoryImpl
 A default implementation of ChannelBufferFactory for use with buffers that have default constructors. More...
class  ChannelFactory
 A channel "factory" class. More...
class  Chanout
 The writing end of a channel. More...
class  CPPCSPError
 The base class for errors in C++CSP2 programs. More...
class  CSProcess
 The base class for processes, that allows processes to be run in a new thead or the same thread. More...
class  DeadlockError
 Thrown when deadlock occurs in a C++CSP2 program; it is a fatal, unrecoverable error. More...
class  FIFOBuffer
 A FIFO buffer with a fixed maximum capacity. More...
class  Guard
 An ALT guard. More...
class  InfiniteFIFOBuffer
 A FIFO buffer of unlimited capacity. More...
class  Mobile
 Templated class implementing MOBILE semantics. More...
class  One2AnyChannel
 A one-to-any unbuffered channel. More...
class  One2OneChannel
 A one-to-one unbuffered channel. More...
class  OutOfResourcesException
 An exception that is thrown whenever C++CSP2 cannot allocate enough resources. More...
class  OverwritingBuffer
 An overwriting FIFO buffer. More...
class  ParallelHelper
 A helper class returned by the InParallel() function. More...
class  ParallelHelperOneThread
 A helper class returned by the InParallelOneThread() function. More...
class  PoisonException
 The poison exception. More...
class  RelTimeoutGuard
 An ALT relative timeout guard, for use in an Alternative. More...
class  RunHelper
 The base class for the various helper classes for the Run function. More...
class  ScopedBarrierEnd
 A scoped Barrier end. More...
class  ScopedExtInput
 Provides an easy way to perform extended inputs using scope. More...
class  ScopedForking
 A class used to fork processes. More...
class  SequentialHelper
 A helper class returned by the InSequence() function. More...
class  SequentialHelperOneThread
 A helper class returned by the InSequenceOneThread() function. More...
class  SizedChannelBufferFactoryImpl
 A default implementation of ChannelBufferFactory for use with buffers that have constructors that take a size argument. More...
class  SkipGuard
 An ALT skip guard, for use in an Alternative. More...
class  StandardChannelFactory
 An implementation of ChannelFactory for standard (unbuffered, non-networked) channels. More...
class  ThreadCSProcess
 A direct sub-class of ThreadCSProcess (except of course CSProcess) is a process that will always be started in a new thread. More...
struct  Time
 C++CSP2 uses this typedef to represent times for the purposes of timeouts and waits. More...
class  TimeoutGuard
 An ALT absolute timeout guard, for use in an Alternative. More...
class  WhiteHoleChannel
 A "none-to-one" channel. More...

Namespaces

namespace  common
 A namespace containing all the commonly used simple processes, such as Id.

NoPoison

Returns a non-poisonable version of the given channel end.

This can be used to supply non-poisonable channel ends to processes, for example:

            One2AnyChannel<int> c;
            One2OneChannel<int> d;
            Run(new Id<int>(NoPoison(c.reader()),d.writer()));

If you call poison() on a non-poisonable channel-end, it does not poison the channel (i.e. it has no effect).

template<typename DATA_TYPE>
Chanout< DATA_TYPE > NoPoison (const Chanout< DATA_TYPE > &out)
template<typename DATA_TYPE>
AltChanin< DATA_TYPE > NoPoison (const AltChanin< DATA_TYPE > &in)
template<typename DATA_TYPE>
Chanin< DATA_TYPE > NoPoison (const Chanin< DATA_TYPE > &in)

Functions

void CPPCSP_Yield ()
 Yields to another user-thread in this kernel-thread.
Time CurrentTime ()
 Gets the current time.
void CurrentTime (Time *const val)
 Gets the current time.
void End_CPPCSP ()
 Cleans up the C++CSP2 run-time.
csp::sign32 GetMilliSeconds (const Time &val)
 Gets the number of milliseconds (truncated) in the specified time.
double GetSeconds (const Time *val)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Included for compatibility with C++CSP v1.x.
double GetSeconds (const Time &val)
 Gets the number of seconds from the specified Time.
template<typename ITERATOR>
ParallelHelper InParallel (ITERATOR begin, ITERATOR end)
 Starts an InParallel chain with the given processes.
ParallelHelper InParallel (const ParallelHelper &p)
 Starts an InParallel chain with the given helper.
ParallelHelper InParallel (ThreadCSProcessPtr p)
 Starts an InParallel chain with the given process.
template<typename ITERATOR>
ParallelHelperOneThread InParallelOneThread (ITERATOR begin, ITERATOR end)
 Starts an InParallelOneThread chain with the given processes.
ParallelHelperOneThread InParallelOneThread (CSProcessPtr p)
 Starts an InParallelOneThread chain with the given process.
template<typename ITERATOR>
SequentialHelper InSequence (ITERATOR begin, ITERATOR end)
 Starts an InSequence chain with the given processes.
SequentialHelper InSequence (ThreadCSProcessPtr p)
 Starts an InSequence chain with the given process.
template<typename ITERATOR>
SequentialHelperOneThread InSequenceOneThread (ITERATOR begin, ITERATOR end)
 Starts an InSequenceOneThread chain with the given processes.
SequentialHelperOneThread InSequenceOneThread (CSProcessPtr p)
 Starts an InSequenceOneThread chain with the given process.
Time MicroSeconds (const long micros)
 Puts the specified integer amount of microseconds into a Time structure.
void MicroSeconds (const long micros, Time *const val)
 Puts the specified integer amount of microseconds into a Time structure.
Time MilliSeconds (const long millis)
 Puts the specified integer amount of milliseconds into a Time structure.
void MilliSeconds (const long millis, Time *const val)
 Puts the specified integer amount of milliseconds into a Time structure.
void Run (ThreadCSProcessPtr)
 Runs the process in a new thread.
void Run (const SequentialHelperOneThread &)
 Runs the processes sequentially in one new thread.
void Run (const ParallelHelperOneThread &)
 Runs the parallel processes in one new thread.
void Run (const SequentialHelper &)
 Runs the processes sequentially in new threads.
void Run (const ParallelHelper &)
 Runs the parallel processes in new threads.
void RunInThisThread (CSProcessPtr)
 Runs the process in this thread.
void RunInThisThread (const SequentialHelperOneThread &)
 Runs the processes sequentially in this thread.
void RunInThisThread (const ParallelHelperOneThread &)
 Runs the parallel processes in this thread.
Time Seconds (const double secs)
 Puts the specified floating-point amount of seconds into a Time structure.
void Seconds (const double secs, Time *const val)
 Puts the specified floating-point amount of seconds into a Time structure.
void SleepFor (const Time &timeToSleepFor)
 Makes the current process sleep for the specified amount of time.
void SleepUntil (const Time &timeToSleepUntil)
 Makes the current process sleep for the specified amount of time.
void Start_CPPCSP ()
 Starts the C++CSP2 run-time.
void Thread_Yield ()
 Yields the processor to another (kernel-)thread.


Function Documentation

void csp::CPPCSP_Yield (  ) 

Yields to another user-thread in this kernel-thread.

If no other user-threads are ready to run in the current kernel-thread, the caller continues without yielding. If you wish to yield to other kernel-threads, use csp::Thread_Yield().

void csp::End_CPPCSP (  ) 

Cleans up the C++CSP2 run-time.

This function should be called as a complement to Start_CPPCSP()

See also:
Start_CPPCSP()

void csp::Start_CPPCSP (  ) 

Starts the C++CSP2 run-time.

This function should be called before using any part of C++CSP2

The intention is that you should call Start_CPPCSP() before using any C++CSP2 features, and then call End_CPPCSP() once you have finished.

If, for some reason, you have to start some threads without using C++CSP2 to do so, you should call this function (and then End_CPPCSP() later) in each of the threads in which you wish to use a feature of C++CSP2.

C++CSP v1.x Compatibility

The equivalent function in C++CSP v1.x was named Start_CSP() and had various parameters. None of those parameters now apply to C++CSP2, so this function does away with all of them. There was also a Start_CSP_NET() function - currently the network functionality has not been implemented in C++CSP2.

void csp::Thread_Yield (  ) 

Yields the processor to another (kernel-)thread.

The other thread may or may not be a C++CSP2 thread, so you may yield to a thread from another program. If you want to yield to other user-threads in this kernel-thread, use csp::CPPCSP_Yield().


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