Group PJ_EVENT¶
-
group
PJ_EVENT
This module provides abstraction to event object (e.g. Win32 Event) where available. Event objects can be used for synchronization among threads.
Functions
-
pj_status_t
pj_event_create
(pj_pool_t *pool, const char *name, pj_bool_t manual_reset, pj_bool_t initial, pj_event_t **event)¶ 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_status_t
pj_event_wait
(pj_event_t *event)¶ Wait for event to be signaled.
- Parameters
event – The event object.
- Returns
zero if successfull.
-
pj_status_t
pj_event_trywait
(pj_event_t *event)¶ Try wait for event object to be signalled.
- Parameters
event – The event object.
- Returns
zero if successfull.
-
pj_status_t
pj_event_set
(pj_event_t *event)¶ 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
event – The event object.
- Returns
zero if successfull.
-
pj_status_t
pj_event_pulse
(pj_event_t *event)¶ 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
event – The event object.
- Returns
zero if successfull.
-
pj_status_t
pj_event_reset
(pj_event_t *event)¶ Set the event object state to non-signaled.
- Parameters
event – The event object.
- Returns
zero if successfull.
-
pj_status_t
pj_event_destroy
(pj_event_t *event)¶ Destroy the event object.
- Parameters
event – The event object.
- Returns
zero if successfull.
-
pj_status_t