Inheritance diagram for csp::ThreadCSProcess:
Processes then spawned by a ThreadCSProcess can either themselves be started in new threads, or started in the same thread. See the Running Processes page for more information.
This class is intended for use to wrap around blocking system calls. For example, a process that reads in a file and then sends the result over a channel and exits is a good candidate for being a sub-class of ThreadCSProcess; it definitely makes blocking system calls and so should go in its own thread to avoid interfering with processes in other threads.
For the most part you should inherit from CSProcess, not this class. Only inherit directly from ThreadCSProcess if you are making blocking calls.
More information on processes is available on the Processes page and the Processes section of the guide.
Protected Member Functions | |
virtual void | run ()=0 |
You must implement this function to provide the code for your process. | |
ThreadCSProcess (unsigned stackSize=1048576) | |
Allows the stack size to be specified. |
csp::ThreadCSProcess::ThreadCSProcess | ( | unsigned | stackSize = 1048576 |
) | [explicit, protected] |
Allows the stack size to be specified.
For information on stack sizes, please read the stacks section of the Processes page.
virtual void csp::ThreadCSProcess::run | ( | ) | [protected, pure 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.
Implemented in csp::common::BarrierSyncer, csp::common::BucketFlusher, csp::common::SkipProcess, csp::common::Id< DATA_TYPE >, csp::common::ExtId< DATA_TYPE >, csp::common::ExtSyncId< DATA_TYPE >, csp::common::WriterProcess< DATA_TYPE >, csp::common::ReaderProcess< DATA_TYPE >, csp::common::WriteOnceProcess< DATA_TYPE >, csp::common::ReadOnceProcess< DATA_TYPE >, csp::common::Prefix< DATA_TYPE >, csp::common::Successor< DATA_TYPE >, csp::common::SeqDelta< DATA_TYPE >, csp::common::SleepForProcess, csp::common::SleepUntilProcess, csp::common::NotifySender< DATA_TYPE >, csp::common::Merger< DATA_TYPE >, csp::common::ExtMerger< DATA_TYPE >, csp::common::EvaluateFunction< RESULT, FUNCTION >, csp::common::FunctionProcess< DATA_TYPE_IN, DATA_TYPE_OUT, FUNCTION >, and csp::common::ChannelPoisoner< CHANNEL_END_TYPE >.