Contains thread-safe operations for inter-thread logic Increment and Decrement can be used to safely add to a shared uint04 value.
More...
|
| static uint04 | decrement (volatile uint04 &value) |
| | Atomically decrements a shared value by one.
|
| static uint04 | increment (volatile uint04 &value) |
| | Atomically increments a shared value by one.
|
| static void | notify (void *object) |
| | Wakes one thread waiting on the given object.
|
| static void | notifyAll (void *object) |
| | Wakes all threads waiting on the given object.
|
| template<class t_type, class t_function_type> |
| static void | ParallelGrainSort (t_type *data, uint04 len, uint04 grain_size, const t_function_type &function) |
| | Recursively sorts an array in parallel, splitting work into async tasks when the array exceeds the grain size, then merging the sorted halves.
|
| template<class t_type, class t_function_type> |
| static void | ParallelSort (t_type *data, uint04 len, t_function_type function) |
| | Sorts an array in parallel using a default grain size.
|
| static void | wait (void *object, std::unique_lock< std::mutex > &lock) |
| | Blocks the calling thread until notified on the given object.
|
| static void | wait (void *object, uint08 time, std::unique_lock< std::mutex > &lock) |
| | Blocks the calling thread until notified or until the timeout elapses.
|
Contains thread-safe operations for inter-thread logic Increment and Decrement can be used to safely add to a shared uint04 value.
Also contains sort, wait, and notify functions.
- See also
- Thread, RWLock
Definition at line 46 of file ConcurrentOperation.h.
◆ decrement()
| uint04 ConcurrentOperation::decrement |
( |
volatile uint04 & | value | ) |
|
|
static |
Atomically decrements a shared value by one.
- Parameters
-
| [in] | value | The volatile shared integer to decrement. |
- Returns
- The value before decrementing.
◆ increment()
| uint04 ConcurrentOperation::increment |
( |
volatile uint04 & | value | ) |
|
|
static |
Atomically increments a shared value by one.
- Parameters
-
| [in] | value | The volatile shared integer to increment. |
- Returns
- The value before incrementing.
Referenced by BasicThread::ThreadLoop().
◆ notify()
| void ConcurrentOperation::notify |
( |
void * | object | ) |
|
|
static |
Wakes one thread waiting on the given object.
- Parameters
-
| [in] | object | The object whose waiting thread should be notified. |
◆ notifyAll()
| void ConcurrentOperation::notifyAll |
( |
void * | object | ) |
|
|
static |
Wakes all threads waiting on the given object.
- Parameters
-
| [in] | object | The object whose waiting threads should be notified. |
◆ ParallelGrainSort()
template<class t_type, class t_function_type>
| void ConcurrentOperation::ParallelGrainSort |
( |
t_type * | data, |
|
|
uint04 | len, |
|
|
uint04 | grain_size, |
|
|
const t_function_type & | function ) |
|
inlinestatic |
Recursively sorts an array in parallel, splitting work into async tasks when the array exceeds the grain size, then merging the sorted halves.
- Parameters
-
| [in] | data | Pointer to the array to sort. |
| [in] | len | The number of elements in the array. |
| [in] | grain_size | The minimum partition size below which sorting falls back to std::sort. |
| [in] | function | The comparison function used for ordering elements. |
Definition at line 104 of file ConcurrentOperation.h.
References ParallelGrainSort().
Referenced by ParallelGrainSort(), and ParallelSort().
◆ ParallelSort()
template<class t_type, class t_function_type>
| void ConcurrentOperation::ParallelSort |
( |
t_type * | data, |
|
|
uint04 | len, |
|
|
t_function_type | function ) |
|
inlinestatic |
Sorts an array in parallel using a default grain size.
- Parameters
-
| [in] | data | Pointer to the array to sort. |
| [in] | len | The number of elements in the array. |
| [in] | function | The comparison function used for ordering elements. |
Definition at line 91 of file ConcurrentOperation.h.
References getMax(), and ParallelGrainSort().
◆ wait() [1/2]
| void ConcurrentOperation::wait |
( |
void * | object, |
|
|
std::unique_lock< std::mutex > & | lock ) |
|
static |
Blocks the calling thread until notified on the given object.
- Parameters
-
| [in] | object | The object to wait on, used as a key for notification. |
| [in] | lock | The unique lock that is released while waiting and reacquired on wake. |
◆ wait() [2/2]
| void ConcurrentOperation::wait |
( |
void * | object, |
|
|
uint08 | time, |
|
|
std::unique_lock< std::mutex > & | lock ) |
|
static |
Blocks the calling thread until notified or until the timeout elapses.
- Parameters
-
| [in] | object | The object to wait on, used as a key for notification. |
| [in] | time | The maximum wait time in milliseconds. |
| [in] | lock | The unique lock that is released while waiting and reacquired on wake. |
The documentation for this class was generated from the following file: