17 #ifndef KAA_KAATHREAD_HPP_
18 #define KAA_KAATHREAD_HPP_
26 #include <condition_variable>
28 #define KAA_MUTEX std::mutex
29 #define KAA_R_MUTEX std::recursive_mutex
31 #define KAA_MUTEX_UNIQUE std::unique_lock<KAA_MUTEX>
32 #define KAA_R_MUTEX_UNIQUE std::unique_lock<KAA_R_MUTEX>
34 #define KAA_LOCK(mtx) mtx.lock()
35 #define KAA_UNLOCK(mtx) mtx.unlock()
37 #define KAA_CONDITION_VARIABLE std::condition_variable
38 #define KAA_CONDITION_WAIT(cond, lck) cond.wait(lck)
39 #define KAA_CONDITION_WAIT_PRED(cond, lck, pred) cond.wait(lck, pred)
40 #define KAA_CONDITION_NOTIFY(cond) cond.notify_one()
41 #define KAA_CONDITION_NOTIFY_ALL(cond) cond.notify_all()
43 #define KAA_CONDITION_VARIABLE_DECLARE(name) KAA_CONDITION_VARIABLE name
44 #define KAA_MUTEX_DECLARE(name) KAA_MUTEX name
45 #define KAA_MUTEX_MUTABLE_DECLARE(name) mutable KAA_MUTEX_DECLARE(name)
46 #define KAA_R_MUTEX_DECLARE(name) KAA_R_MUTEX name
47 #define KAA_R_MUTEX_MUTABLE_DECLARE(name) mutable KAA_R_MUTEX_DECLARE(name)
48 #define KAA_MUTEX_UNIQUE_DECLARE(name, mtx) KAA_MUTEX_UNIQUE name(mtx)
49 #define KAA_R_MUTEX_UNIQUE_DECLARE(name, mtx) KAA_R_MUTEX_UNIQUE name(mtx)
58 #define kaa_thread_local thread_local
65 #define KAA_MUTEX_UNIQUE
66 #define KAA_R_MUTEX_UNIQUE
69 #define KAA_UNLOCK(mtx)
71 #define KAA_CONDITION_VARIABLE
72 #define KAA_CONDITION_WAIT(cond, lck)
73 #define KAA_CONDITION_WAIT_PRED(cond, lck, pred)
74 #define KAA_CONDITION_NOTIFY(cond)
75 #define KAA_CONDITION_NOTIFY_ALL(cond)
77 #define KAA_CONDITION_VARIABLE_DECLARE(name)
78 #define KAA_MUTEX_DECLARE(name)
79 #define KAA_MUTEX_MUTABLE_DECLARE(name)
80 #define KAA_R_MUTEX_DECLARE(name)
81 #define KAA_R_MUTEX_MUTABLE_DECLARE(name)
82 #define KAA_MUTEX_UNIQUE_DECLARE(name, mtx)
83 #define KAA_R_MUTEX_UNIQUE_DECLARE(name, mtx)
88 #define kaa_thread_local
std::atomic_bool bool_type
std::atomic_int_fast32_t RequestId