#include <synchro.h>
Public Types | |
typedef Ftor::result_type | result_type |
Public Member Functions | |
void | push_node (node *anAddr) |
iterator | begin (void) |
iterator | end (void) |
Private Attributes | |
iterator | _First |
'_First' points on the first launched sub-thread, i.e. the oldest one. | |
iterator | _Last |
Classes | |
class | iterator |
class | node |
Used for chaining the 'forkify' objects. The derived class must have a 'run' method, which are tail-recursive (This tail recursivity is not an obligation, just a fact. Please appreciate that their calls may be transformed into an iteration). One can have as many sub-threads as needed. The stack is not very big.
typedef Ftor::result_type rpa::thread_stack< Ftor, Thr >::result_type |
iterator rpa::thread_stack< Ftor, Thr >::begin | ( | void | ) | [inline] |
Enumerate all 'node' objects started in a '<algorithm>_vec. Used by the reduction algorithm to wait for the sub-threads to be joined.
iterator rpa::thread_stack< Ftor, Thr >::end | ( | void | ) | [inline] |
void rpa::thread_stack< Ftor, Thr >::push_node | ( | node * | anAddr | ) | [inline] |
Only called by the main thread, therefore needs NO mutex. Used to put the address of a temporary variable on the stack. Because we wait the end of sub-threads, and will do reduction at the deepest call of 'run', all temporary variables (one per sub-thread), holding for examples intermediary return values, will still be on the stack.
Links the before-last thread to the last one. So, the threads are in on a single-linked list which is walked on for results reduction.
Appends to the threads, a new 'node' associated to a new thread.
iterator rpa::thread_stack< Ftor, Thr >::_First [private] |
'_First' points on the first launched sub-thread, i.e. the oldest one.
iterator rpa::thread_stack< Ftor, Thr >::_Last [private] |