CnC context bringing together collections (for steps, items and tags). More...
Public Member Functions | |
| context () | |
| default constructor | |
| virtual | ~context () |
| destructor | |
| error_type | wait () |
| wait until all the steps prescribed by this context have completed execution. | |
| void | flush_gets () |
| used with the preschedule tuner to finalize 'gets' in the pre-execution of a step | |
| void | unsafe_reset () |
| virtual void | serialize (serializer &) |
| (distCnC) overload this if default construction on remote processes is not enough. | |
CnC context bringing together collections (for steps, items and tags).
The user needs to derive his or her own context from the CnC::context. The template argument to context is the user's context class itself.
For example,
struct my_context : public CnC::context< my_context > { CnC::step_collection< FindPrimes > steps; CnC::tag_collection< int > oddNums; CnC::item_collection< int,int > primes; my_context() : CnC::context< my_context >(), steps( this ), oddNums( this ), primes( this ) { oddNums.prescribes( steps ); } };
Several contexts can be created and executed simultaneously.
Execution starts as soon as a step(-instance) is prescribed through putting a tag. All ready steps will be executed even if CnC::context::wait() is never be called.
It is recommended to declare collections as members of a context derived from CnC::context. This yields more maintanable code and future versions of CnC may require this convention.
| void flush_gets | ( | ) |
used with the preschedule tuner to finalize 'gets' in the pre-execution of a step
Call this after last call to the non-blocking item_collection::unsafe_get method.
| void unsafe_reset | ( | ) |
reset all collections of this context
| error_type wait | ( | ) |
wait until all the steps prescribed by this context have completed execution.
1.7.6.1