8 #ifndef INCL_evo_event_thread_h 9 #define INCL_evo_event_thread_h 70 shared_state.
waitms = wait_timeout_ms;
83 This&
add(
Event* event, ulongl spinwait_ns=1) {
84 shared_state.queue.
add(event, spinwait_ns);
85 shared_state.queue.notify_multiwait(shared_state.condmutex);
97 shared_state.condmutex.lock_notify_all();
107 static void thread_run(
void* arg) {
ulong waitms
Thread wait timeout in milliseconds.
Definition: event_thread.h:25
This & shutdown()
Stop processing events and shutdown threads.
Definition: event_thread.h:95
This & add(Event *event, ulongl spinwait_ns=1)
Add an event to queue to be processed.
Definition: event_thread.h:83
AtomicInt shutdown
Thread shutdown flag.
Definition: event_thread.h:24
Manages a single thread of execution.
Definition: thread.h:529
#define EVO_ONCPP11(EXPR)
Compile EXPR only if C++11 support is detected, otherwise this is a no-op.
Definition: sys.h:259
Condition object for thread synchronization.
Definition: thread.h:243
Evo threads implementation.
EventThreadPool This
This type.
Definition: event_thread.h:64
void process_multiwait(U &condmutex, AtomicInt &stopflag, ulong waitms=1)
Process queued events until stopflag is set, allowing multiple consumer threads, and waiting with con...
Definition: event.h:277
EventQueue queue
EventQueue used by pool.
Definition: event_thread.h:22
bool process_multi(U &mutex)
Process queued events and return, allowing multiple consumer threads.
Definition: event.h:247
#define EVO_ATOMIC_ACQUIRE
Start "acquire" memory ordering barrier, usually followed by a matching "release" barrier...
Definition: atomic.h:27
Internal state used by EventThreadPool.
Definition: event_thread.h:21
Evo C++ Library namespace.
Definition: alg.h:11
Manages a group of threads with shared state.
Definition: thread.h:1104
EventThreadPool(ulong wait_timeout_ms=1)
Constructor.
Definition: event_thread.h:69
#define EVO_ATOMIC_RELEASE
Release (end) memory ordering barrier started with "consume" or "acquire" barrier.
Definition: atomic.h:30
Event base type used with EventQueue.
Definition: event.h:31
Evo async event handling.
Event processing thread pool.
Definition: event_thread.h:62
Condition condmutex
Condition for multithreading.
Definition: event_thread.h:23
T load(MemOrder mem_order=std::memory_order_seq_cst) const
Load and return current value.
Lock-free event processing queue.
Definition: event.h:146