1 #ifndef BMTASK__H__INCLUDED__
2 #define BMTASK__H__INCLUDED__
49 typedef void* (*task_func_type)(
void*);
90 done.store(
td.done.load());
95 this->
init(f, argptr);
106 done.store(1, std::memory_order_release);
138 template<
typename BVAlloc>
200 tdescr->
argp = tdescr;
211 template <
typename T>
214 #if BM_DONT_WANT_TYPE_TRAITS_HEADER
215 constexpr
static bool value = noexcept(((
T*)
nullptr)->lock());
217 constexpr
static bool value = noexcept(std::declval<T>().lock());
Simple heap allocated vector based on bvector allocator.
Simple scoped lock guard.
lock_guard< Lock > & operator=(const lock_guard< Lock > &)=delete
lock_guard(const lock_guard< Lock > &)=delete
lock_guard(Lock &lk) noexcept(bm::is_lock_noexcept< Lock >::value)
Interface definition (base class) for a group of tasks (batch)
virtual size_type size() const =0
Return size of batch.
virtual ~task_batch_base()
virtual bm::task_descr * get_task(size_type task_idx)=0
Get task by index in the batch.
Basic implementation for collection of tasks for parallel execution.
task_vector_type & get_task_vector() noexcept
Get access to internal task vector.
virtual size_type size() const noexcept
task_batch_base intreface implementation
BVAlloc bv_allocator_type
task_batch_base::size_type size_type
void add(task_function_t f, void *argptr)
std::vector< bm::task_descr > task_vector_type
virtual bm::task_descr * get_task(size_type task_idx)
Get task by index in the batch.
const task_vector_type & get_task_vector() const noexcept
task_vector_type task_vect_
list of tasks
std::function< int(void *)> task_function_t
Typedef for a call-back functional for lambda capture.
void run_task_batch(task_batch_base &tasks)
Run task batch sequentially.
unsigned int
A callback function used to compare two keys in a database.
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n td
unsigned long long int id64_t
"noexcept" traits detection for T::lock()
constexpr static bool value
BitMagic task with a captured function.
task_descr(task_function_t f, void *argptr=0) noexcept
std::atomic_bool done
0 - pending
task_descr(const task_descr &td)
@ barrier_ok
barrier waits all prev.tasks done without error
@ no_flag
no flag specified
@ barrier_any
barrier waits all prev tasks done (success or not)
bm::id64_t flags
task flags to designate barriers
task_function_t func
captured function callback
void init(task_function_t f, void *argptr) noexcept