This module provides abstraction to event object (e.g. Win32 Event) where available. Event objects can be used for synchronization among threads.
◆ pj_event_create()
Create event object.
- Parameters
-
pool | The pool. |
name | The name of the event object (for logging purpose). |
manual_reset | Specify whether the event is manual-reset |
initial | Specify the initial state of the event object. |
event | Pointer to hold the returned event object. |
- Returns
- event handle, or NULL if failed.
◆ pj_event_destroy()
Destroy the event object.
- Parameters
-
- Returns
- zero if successfull.
◆ pj_event_pulse()
Set the event object to signaled state to release appropriate number of waiting threads and then reset the event object to non-signaled. For manual-reset event, this function will release all waiting threads. For auto-reset event, this function will only release one waiting thread.
- Parameters
-
- Returns
- zero if successfull.
◆ pj_event_reset()
Set the event object state to non-signaled.
- Parameters
-
- Returns
- zero if successfull.
◆ pj_event_set()
Set the event object state to signaled. For auto-reset event, this will only release the first thread that are waiting on the event. For manual reset event, the state remains signaled until the event is reset. If there is no thread waiting on the event, the event object state remains signaled.
- Parameters
-
- Returns
- zero if successfull.
◆ pj_event_trywait()
Try wait for event object to be signalled.
- Parameters
-
- Returns
- zero if successfull.
◆ pj_event_wait()
Wait for event to be signaled.
- Parameters
-
- Returns
- zero if successfull.