![]() |
This is Unofficial EPICS BASE Doxygen Site
|
APIs for the epicsEvent binary semaphore. More...
#include "libComAPI.h"
#include "osdEvent.h"
Go to the source code of this file.
Macros | |
#define | epicsEventWaitStatus epicsEventStatus |
Old name provided for backwards compatibility. More... | |
#define | epicsEventWaitOK epicsEventOK |
Old name provided for backwards compatibility. More... | |
#define | epicsEventWaitError epicsEventError |
Old name provided for backwards compatibility. More... | |
#define | epicsEventSignal(ID) epicsEventMustTrigger(ID) |
A synonym for epicsEventTrigger(). More... | |
Typedefs | |
typedef struct epicsEventOSD * | epicsEventId |
An identifier for an epicsEvent for use with the C API. More... | |
Enumerations | |
enum | epicsEventStatus { epicsEventOK = 0, epicsEventWaitTimeout, epicsEventError } |
Return status from several C API routines. More... | |
enum | epicsEventInitialState { epicsEventEmpty, epicsEventFull } |
Possible initial states of a new epicsEvent. More... | |
Functions | |
LIBCOM_API epicsEventId | epicsEventCreate (epicsEventInitialState initialState) |
Create an epicsEvent for use from C code, or return NULL. More... | |
LIBCOM_API epicsEventId | epicsEventMustCreate (epicsEventInitialState initialState) |
Create an epicsEvent for use from C code. More... | |
LIBCOM_API void | epicsEventDestroy (epicsEventId id) |
Destroy an epicsEvent and any resources it holds. More... | |
LIBCOM_API epicsEventStatus | epicsEventTrigger (epicsEventId id) |
Trigger an event i.e. ensures the next or current call to wait completes. More... | |
LIBCOM_API void | epicsEventMustTrigger (epicsEventId id) |
Trigger an event. More... | |
LIBCOM_API epicsEventStatus | epicsEventWait (epicsEventId id) |
Wait for an event. More... | |
LIBCOM_API void | epicsEventMustWait (epicsEventId id) |
Wait for an event (see epicsEventWait()). More... | |
LIBCOM_API epicsEventStatus | epicsEventWaitWithTimeout (epicsEventId id, double timeOut) |
Wait an the event or until the specified timeout period is over. More... | |
LIBCOM_API epicsEventStatus | epicsEventTryWait (epicsEventId id) |
Similar to wait() except that if the event is currenly empty the call will return immediately with status epicsEventWaitTimeout . More... | |
LIBCOM_API void | epicsEventShow (epicsEventId id, unsigned int level) |
Display information about the semaphore. More... | |
APIs for the epicsEvent binary semaphore.
Defines the C++ and C API's for a simple binary semaphore. If multiple threads are waiting on the same event, only one of them will be woken when the event is signalled.
The primary use of an event semaphore is for thread synchronization. An example of using an event semaphore is a consumer thread that processes requests from one or more producer threads. For example:
When creating the consumer thread also create an epicsEvent.
The consumer thread has code containing:
Producers create requests and issue the statement:
Definition in file epicsEvent.h.
#define epicsEventSignal | ( | ID | ) | epicsEventMustTrigger(ID) |
A synonym for epicsEventTrigger().
ID | The event identifier. |
Definition at line 172 of file epicsEvent.h.
#define epicsEventWaitError epicsEventError |
Old name provided for backwards compatibility.
Definition at line 60 of file epicsEvent.h.
#define epicsEventWaitOK epicsEventOK |
Old name provided for backwards compatibility.
Definition at line 58 of file epicsEvent.h.
#define epicsEventWaitStatus epicsEventStatus |
Old name provided for backwards compatibility.
Definition at line 56 of file epicsEvent.h.
typedef struct epicsEventOSD* epicsEventId |
An identifier for an epicsEvent for use with the C API.
Definition at line 46 of file epicsEvent.h.
Possible initial states of a new epicsEvent.
Enumerator | |
---|---|
epicsEventEmpty | |
epicsEventFull |
Definition at line 63 of file epicsEvent.h.
enum epicsEventStatus |
Return status from several C API routines.
Enumerator | |
---|---|
epicsEventOK | |
epicsEventWaitTimeout | |
epicsEventError |
Definition at line 49 of file epicsEvent.h.
LIBCOM_API epicsEventId epicsEventCreate | ( | epicsEventInitialState | initialState | ) |
Create an epicsEvent for use from C code, or return NULL.
initialState | Starting state, epicsEventEmpty or epicsEventFull . |
Definition at line 47 of file osdEvent.c.
LIBCOM_API void epicsEventDestroy | ( | epicsEventId | id | ) |
Destroy an epicsEvent and any resources it holds.
No calls to any epicsEventWait routines can be active when this call is made.
id | The event identifier. |
Definition at line 70 of file osdEvent.c.
LIBCOM_API epicsEventId epicsEventMustCreate | ( | epicsEventInitialState | initialState | ) |
Create an epicsEvent for use from C code.
This routine does not return if the object could not be created.
initialState | Starting state, epicsEventEmpty or epicsEventFull . |
Definition at line 106 of file epicsEvent.cpp.
LIBCOM_API void epicsEventMustTrigger | ( | epicsEventId | id | ) |
Trigger an event.
This routine does not return if the identifier is invalid.
id | The event identifier. |
Definition at line 116 of file epicsEvent.cpp.
LIBCOM_API void epicsEventMustWait | ( | epicsEventId | id | ) |
Wait for an event (see epicsEventWait()).
This routine does not return if the identifier is invalid.
id | The event identifier. |
Definition at line 123 of file epicsEvent.cpp.
LIBCOM_API void epicsEventShow | ( | epicsEventId | id, |
unsigned int | level | ||
) |
Display information about the semaphore.
id | The event identifier. |
level | An unsigned int for the level of information to be displayed. |
Definition at line 150 of file osdEvent.c.
LIBCOM_API epicsEventStatus epicsEventTrigger | ( | epicsEventId | id | ) |
Trigger an event i.e. ensures the next or current call to wait completes.
id | The event identifier. |
Definition at line 80 of file osdEvent.c.
LIBCOM_API epicsEventStatus epicsEventTryWait | ( | epicsEventId | id | ) |
Similar to wait() except that if the event is currenly empty the call will return immediately with status epicsEventWaitTimeout
.
id | The event identifier. |
epicsEventWaitTimeout
when the event is empty. Definition at line 145 of file osdEvent.c.
LIBCOM_API epicsEventStatus epicsEventWait | ( | epicsEventId | id | ) |
Wait for an event.
id | The event identifier. |
Definition at line 95 of file osdEvent.c.
LIBCOM_API epicsEventStatus epicsEventWaitWithTimeout | ( | epicsEventId | id, |
double | timeOut | ||
) |
Wait an the event or until the specified timeout period is over.
id | The event identifier. |
timeOut | The timeout delay in seconds. |
Definition at line 117 of file osdEvent.c.