#include <Event.h>
Public Types | |
| enum | EWaitCode { EVENT_WAIT_OK , EVENT_WAIT_TIMEOUT , EVENT_WAIT_ERROR } |
| Wait result codes. More... | |
Public Member Functions | |
| Event (bool autoRelease=true, bool signaled=false) | |
| void | set () |
| EWaitCode | wait (unsigned int msecs=EVENT_WAIT_INFINITE) const |
| void | reset () |
Platform-independent Event implementation. Can be used in multi-threaded scenarios to create simple semaphore-like locks on which clients can wait and notify in order to synchronize execution flows.
| mel::core::Event::Event | ( | bool | autoRelease = true, |
| bool | signaled = false |
||
| ) |
Creates a new event.
| autoRelease | flag indicating if the new vent should be auto-reset whenever a wait operation terminates (the default value is true) |
| signaled | flag indicating the initial status of the event. If set to true, the event will be created as "signaled" meaning the next wait operation will return immediately. |
| void mel::core::Event::reset | ( | ) |
Resets the event, so any further calls to Event::wait will force a lock on the calling thread.
| void mel::core::Event::set | ( | ) |
Sets the event. If there were more than one thread locked on an Event::wait call, only one of them will be unlocked. If there were no threads waiting, then the next one calling Event:wait won't be locked.
| EWaitCode mel::core::Event::wait | ( | unsigned int | msecs = EVENT_WAIT_INFINITE | ) | const |
Wait for event. If the event was not yet set, the calling thread will be locked until the event is set.
| [in] | msecs | milliseconds to wait for. |