STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Attributes | List of all members
Concurrency::_Range< _Index_type > Class Template Reference

#include <ppl.h>

Public Member Functions

 _Range (_Index_type _Current_iteration, _Index_type _Last_iteration)
 
void _Send_range (_Range< _Index_type > *_Helper_range)
 
void _Steal_range (_Range< _Index_type > *_Helper_range)
 
_Index_type _Number_of_iterations () const
 
_Index_type _Get_current_iteration () const
 
void _Set_current_iteration (const _Index_type _I)
 
 __declspec (property(get=_Get_current_iteration, put=_Set_current_iteration)) _Index_type _M_current_iteration
 
_Index_type _Get_last_iteration () const
 
void _Set_last_iteration (const _Index_type _I)
 
 __declspec (property(get=_Get_last_iteration, put=_Set_last_iteration)) _Index_type _M_last_iteration
 

Private Attributes

volatile _Index_type _M_current
 
volatile _Index_type _M_last
 

Constructor & Destructor Documentation

template<typename _Index_type>
Concurrency::_Range< _Index_type >::_Range ( _Index_type  _Current_iteration,
_Index_type  _Last_iteration 
)
inline
1810  :
1811  _M_current(_Current_iteration), _M_last(_Last_iteration)
1812  {
1813  // On creation, the range shall have at least 1 iteration.
1815  }
volatile _Index_type _M_current
Definition: ppl.h:1889
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
_Index_type _Number_of_iterations() const
Definition: ppl.h:1852
volatile _Index_type _M_last
Definition: ppl.h:1890

Member Function Documentation

template<typename _Index_type>
Concurrency::_Range< _Index_type >::__declspec ( property(get=_Get_current_iteration, put=_Set_current_iteration )
template<typename _Index_type>
Concurrency::_Range< _Index_type >::__declspec ( property(get=_Get_last_iteration, put=_Set_last_iteration )
template<typename _Index_type>
_Index_type Concurrency::_Range< _Index_type >::_Get_current_iteration ( ) const
inline
1859  {
1860  return _M_current;
1861  }
volatile _Index_type _M_current
Definition: ppl.h:1889
template<typename _Index_type>
_Index_type Concurrency::_Range< _Index_type >::_Get_last_iteration ( ) const
inline
1873  {
1874  return _M_last;
1875  }
volatile _Index_type _M_last
Definition: ppl.h:1890
template<typename _Index_type>
_Index_type Concurrency::_Range< _Index_type >::_Number_of_iterations ( ) const
inline
1853  {
1854  return (_M_last_iteration - _M_current_iteration);
1855  }
template<typename _Index_type>
void Concurrency::_Range< _Index_type >::_Send_range ( _Range< _Index_type > *  _Helper_range)
inline
1819  {
1820  // If there are no iterations other than the current one left until finish, there is no help
1821  // needed. Set the pointer to a special value that helper will understand and continue
1822  // doing the work.
1823  _Index_type _Remaining_iterations = _Number_of_iterations();
1824  if (_Remaining_iterations > 1)
1825  {
1826  // Compute the two pieces of the work range: one for the worker and one for helper class.
1827  _M_last_iteration = _M_current_iteration + _Remaining_iterations / 2;
1828 
1829  // There needs to be at least 1 iteration left because the current iteration cannot be sent.
1831  }
1832 
1833  // This is also a signal for the helper that a range has been sent to it.
1834  _Helper_range->_M_current_iteration = _M_last_iteration;
1835  }
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
_Index_type _Number_of_iterations() const
Definition: ppl.h:1852
template<typename _Index_type>
void Concurrency::_Range< _Index_type >::_Set_current_iteration ( const _Index_type  _I)
inline
1865  {
1866  _M_current = _I;
1867  }
volatile _Index_type _M_current
Definition: ppl.h:1889
template<typename _Index_type>
void Concurrency::_Range< _Index_type >::_Set_last_iteration ( const _Index_type  _I)
inline
1879  {
1880  _M_last = _I;
1881  }
volatile _Index_type _M_last
Definition: ppl.h:1890
template<typename _Index_type>
void Concurrency::_Range< _Index_type >::_Steal_range ( _Range< _Index_type > *  _Helper_range)
inline
1839  {
1840  // We allow stealing only from a range that has at least 1 iteration
1842 
1843  _Index_type _Current_iter = _M_current_iteration;
1844 
1845  _Helper_range->_M_current_iteration = _Current_iter + 1;
1846  _Helper_range->_M_last_iteration = _M_last_iteration;
1847 
1848  _M_last_iteration = _Current_iter + 1;
1849  }
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
_Index_type _Number_of_iterations() const
Definition: ppl.h:1852

Member Data Documentation

template<typename _Index_type>
volatile _Index_type Concurrency::_Range< _Index_type >::_M_current
private
template<typename _Index_type>
volatile _Index_type Concurrency::_Range< _Index_type >::_M_last
private

The documentation for this class was generated from the following file: