33#include <NDEVR/BaseValues.h>
49 static void wait(
void*
object, std::unique_lock<std::mutex>& lock);
50 static void wait(
void*
object,
uint08 time, std::unique_lock<std::mutex>& lock);
53 template<
class t_type,
class t_function_type>
56 ParallelGrainSort(data, len,
getMax(1024U, len / 16U), function);
58 template<
class t_type,
class t_function_type>
65 std::sort(data, data + len, function);
69 auto future = std::async(ParallelGrainSort<t_type, t_function_type>, data, len / 2, grain_size, function);
73 ParallelGrainSort(data + len / 2, len - len / 2, grain_size, function);
77 std::inplace_merge(data, data + len / 2, data + len, function);
Contains thread-safe operations for inter-thread logic Increment and Decrement can be used to safely ...
Definition ConcurrentOperation.h:45
static uint04 decrement(volatile uint04 &value)
static void wait(void *object, std::unique_lock< std::mutex > &lock)
static void notify(void *object)
static void ParallelSort(t_type *data, uint04 len, t_function_type function)
Definition ConcurrentOperation.h:54
static void notifyAll(void *object)
static void wait(void *object, uint08 time, std::unique_lock< std::mutex > &lock)
static uint04 increment(volatile uint04 &value)
static void ParallelGrainSort(t_type *data, uint04 len, uint04 grain_size, const t_function_type &function)
Definition ConcurrentOperation.h:59
constexpr t_type getMax(const t_type &left, const t_type &right)
Finds the max of the given arguments using the > operator The only requirement is that t_type have > ...
Definition BaseFunctions.hpp:94
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer
Definition BaseValues.hpp:106
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96