Wrapper classes for Windows synchronization mechanisms.
More...
|
class | mlib::current_thread |
| Currently executing thread object. More...
|
|
class | mlib::criticalsection |
| Lightweight inter-thread synchronization. More...
|
|
class | mlib::lock |
| Automatic wrapper for critical sections. More...
|
|
class | mlib::event |
| Events have only two states: signaled and not signaled. More...
|
|
class | mlib::mutex |
| Wrapper for Windows mutexes. More...
|
|
class | mlib::semaphore |
| Wrapper for Windows semaphore objects. More...
|
|
class | mlib::syncbase |
| Base class for all named synchronization objects. More...
|
|
class | mlib::thread |
| Wrapper for a Windows thread. More...
|
|
class | mlib::wtimer |
| Waitable timer. More...
|
|
template<typename T > |
DWORD | mlib::wait_all (const T *objs, int count, DWORD msec=INFINITE) |
| Wait for multiple objects until all become signaled.
|
|
template<typename T > |
DWORD | mlib::wait_all (std::initializer_list< const T * > objs, DWORD msec=INFINITE) |
| Wait for multiple objects until all become signaled.
|
|
template<typename T > |
DWORD | mlib::wait_all (std::initializer_list< const T * > objs, std::chrono::milliseconds limit) |
| Wait for multiple objects until all become signaled.
|
|
template<typename T > |
DWORD | mlib::wait_any (const T *objs, int count, DWORD msec=INFINITE) |
| Wait for multiple objects until any of them becomes signaled.
|
|
template<typename T > |
DWORD | mlib::wait_any (std::initializer_list< const T * > objs, DWORD msec=INFINITE) |
| Wait for multiple objects until any of them becomes signaled.
|
|
template<typename T > |
DWORD | mlib::wait_any (std::initializer_list< const T * > objs, std::chrono::milliseconds timeout) |
| Wait for multiple objects until any of them becomes signaled.
|
|
template<typename T > |
DWORD | mlib::wait_msg (const T *objs, int count, bool all=true, DWORD msec=INFINITE, DWORD mask=QS_ALLINPUT) |
| Wait for multiple objects or a message to be queued.
|
|
template<typename T > |
DWORD | mlib::wait_msg (std::initializer_list< const T * > objs, bool all=true, DWORD msec=INFINITE, DWORD mask=QS_ALLINPUT) |
| Wait for multiple objects or a message to be queued.
|
|
Wrapper classes for Windows synchronization mechanisms.
While, currently, most of these objects have standard conforming replacements (std::mutex, std::semaphore, std::thread, etc.) there are still use cases where standard versions lack functionality compared to objects in this library.
One such case is when trying to achieve synchronization between different processes. Standard objects have no (portable) mechanism for sharing them between processes. Other limitations include wakeup on message received (syncbase::wait_alertable) and many limitations related to mlib::thread objects.
◆ wait_all() [1/3]
template<typename T >
DWORD mlib::wait_all |
( |
const T * |
objs, |
|
|
int |
count, |
|
|
DWORD |
msec = INFINITE |
|
) |
| |
|
inline |
Wait for multiple objects until all become signaled.
Wrapper for WaitForMultipleObjects Windows API function.
- Parameters
-
objs | array of objects to wait for |
count | number of objects in array |
msec | time limit (in milliseconds) |
◆ wait_all() [2/3]
template<typename T >
DWORD mlib::wait_all |
( |
std::initializer_list< const T * > |
objs, |
|
|
DWORD |
msec = INFINITE |
|
) |
| |
|
inline |
Wait for multiple objects until all become signaled.
Wrapper for WaitForMultipleObjects Windows API function.
- Parameters
-
objs | objects to wait for |
msec | time limit (in milliseconds) |
◆ wait_all() [3/3]
template<typename T >
DWORD mlib::wait_all |
( |
std::initializer_list< const T * > |
objs, |
|
|
std::chrono::milliseconds |
limit |
|
) |
| |
|
inline |
Wait for multiple objects until all become signaled.
Wrapper for WaitForMultipleObjects Windows API function.
- Parameters
-
objs | objects to wait for |
limit | time limit in milliseconds |
◆ wait_any() [1/3]
template<typename T >
DWORD mlib::wait_any |
( |
const T * |
objs, |
|
|
int |
count, |
|
|
DWORD |
msec = INFINITE |
|
) |
| |
|
inline |
Wait for multiple objects until any of them becomes signaled.
Wrapper for WaitForMultipleObjects Windows API function.
- Parameters
-
objs | array of objects to wait for |
count | number of objects in array |
msec | timeout interval (in milliseconds) |
◆ wait_any() [2/3]
template<typename T >
DWORD mlib::wait_any |
( |
std::initializer_list< const T * > |
objs, |
|
|
DWORD |
msec = INFINITE |
|
) |
| |
|
inline |
Wait for multiple objects until any of them becomes signaled.
Wrapper for WaitForMultipleObjects Windows API function.
- Parameters
-
objs | objects to wait for |
msec | timeout interval (in milliseconds) |
◆ wait_any() [3/3]
template<typename T >
DWORD mlib::wait_any |
( |
std::initializer_list< const T * > |
objs, |
|
|
std::chrono::milliseconds |
timeout |
|
) |
| |
|
inline |
Wait for multiple objects until any of them becomes signaled.
Wrapper for WaitForMultipleObjects Windows API function.
- Parameters
-
objs | objects to wait for |
timeout | timeout interval |
◆ wait_msg() [1/2]
template<typename T >
DWORD mlib::wait_msg |
( |
const T * |
objs, |
|
|
int |
count, |
|
|
bool |
all = true , |
|
|
DWORD |
msec = INFINITE , |
|
|
DWORD |
mask = QS_ALLINPUT |
|
) |
| |
|
inline |
Wait for multiple objects or a message to be queued.
Wrapper for MsgWaitForMultipleObjects Windows API function.
- Parameters
-
objs | array of objects to wait for |
count | number of objects in array |
all | if true , wait for all objects to become signaled |
msec | timeout interval (in milliseconds) |
mask | message mask (combination of QS_... constants) |
◆ wait_msg() [2/2]
template<typename T >
DWORD mlib::wait_msg |
( |
std::initializer_list< const T * > |
objs, |
|
|
bool |
all = true , |
|
|
DWORD |
msec = INFINITE , |
|
|
DWORD |
mask = QS_ALLINPUT |
|
) |
| |
|
inline |
Wait for multiple objects or a message to be queued.
Wrapper for MsgWaitForMultipleObjects Windows API function.
- Parameters
-
objs | objects to wait for |
all | if true , wait for all objects to become signaled |
msec | timeout interval (in milliseconds) |
mask | message mask (combination of QS_... constants) |