rpa::thread_stack< Ftor, Thr > Class Template Reference

Base class for all the objects 'loop' of all algorithms. More...

#include <synchro.h>

List of all members.

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


Detailed Description

template<class Ftor, class Thr>
class rpa::thread_stack< Ftor, Thr >

Base class for all the objects 'loop' of all algorithms.

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.


Member Typedef Documentation

template<class Ftor, class Thr>
typedef Ftor::result_type rpa::thread_stack< Ftor, Thr >::result_type

Reimplemented in rpa::accumulate_loop_t< Args, Task, Thread >, rpa::remove_copy_if_loop_thr< Args, Task, Thread >, rpa::transform_loop_thr< Args, Task, Thread >, and rpa::accumulate_loop_t< Args, rpa::coroutine_step< accumulate_vec, thrify_t >, std::iterator_traits< ThrIter >::value_type >.


Member Function Documentation

template<class Ftor, class Thr>
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.

template<class Ftor, class Thr>
iterator rpa::thread_stack< Ftor, Thr >::end ( void   )  [inline]

template<class Ftor, class Thr>
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.


Member Data Documentation

template<class Ftor, class Thr>
iterator rpa::thread_stack< Ftor, Thr >::_First [private]

'_First' points on the first launched sub-thread, i.e. the oldest one.

template<class Ftor, class Thr>
iterator rpa::thread_stack< Ftor, Thr >::_Last [private]


The documentation for this class was generated from the following file:
Generated on Tue Sep 25 10:20:38 2007 for rpa by  doxygen 1.4.7