23 #ifndef __MULTITHREAD_EVENT_H_ 24 #define __MULTITHREAD_EVENT_H_ 40 Event(
bool auto_reset=
true );
73 bool Wait(
const timespec& timeout );
79 inline bool Wait( uint64_t timeout ) {
return (timeout == UINT64_MAX) ?
Wait() :
Wait(
timeNew(timeout*1000*1000)); }
91 inline bool WaitUs( uint64_t timeout ) {
return (timeout == UINT64_MAX) ?
Wait() :
Wait(
timeNew(timeout*1000)); }
96 inline pthread_cond_t*
GetID() {
return &
mID; }
pthread_cond_t * GetID()
Get the Event object.
Definition: Event.h:96
A lightweight mutual exclusion lock.
Definition: Mutex.h:35
void Lock()
Aquire the lock, whenever it becomes available.
Definition: Mutex.h:58
bool Query()
Query the status of this event.
void Wake()
Raise the event.
bool Wait(uint64_t timeout)
Wait for a specified number of milliseconds until this event is raised or timeout occurs...
Definition: Event.h:79
Mutex mQueryMutex
Definition: Event.h:102
bool WaitNs(uint64_t timeout)
Wait for a specified number of nanoseconds until this event is raised or timeout occurs.
Definition: Event.h:85
pthread_cond_t mID
Definition: Event.h:100
void Unlock()
Release the lock.
Definition: Mutex.h:63
timespec timeNew(time_t seconds, long int nanoseconds)
Return an initialized timespec
Definition: timespec.h:57
bool WaitUs(uint64_t timeout)
Wait for a specified number of microseconds until this event is raised or timeout occurs...
Definition: Event.h:91
Event(bool auto_reset=true)
Event constructor.
void Reset()
Reset the event status to un-raised.
Definition: Event.h:55
Event object for signalling other threads.
Definition: Event.h:33
bool Wait()
Wait until this event is raised.
bool mQuery
Definition: Event.h:103
bool mAutoReset
Definition: Event.h:104