![]() |
This is Unofficial EPICS BASE Doxygen Site
|
APIs for the epicsMutex mutual exclusion semaphore. More...
Go to the source code of this file.
Macros | |
#define | epicsMutexCreate() epicsMutexOsiCreate(__FILE__,__LINE__) |
Create an epicsMutex semaphore for use from C code. More... | |
#define | epicsMutexMustCreate() epicsMutexOsiMustCreate(__FILE__,__LINE__) |
Create an epicsMutex semaphore for use from C code. More... | |
#define | epicsMutexMustLock(ID) |
Claim a semaphore (see epicsMutexLock()). More... | |
Typedefs | |
typedef struct epicsMutexParm * | epicsMutexId |
An identifier for an epicsMutex for use with the C API. More... | |
Enumerations | |
enum | epicsMutexLockStatus { epicsMutexLockOK = 0, epicsMutexLockTimeout, epicsMutexLockError } |
Functions | |
LIBCOM_API epicsMutexId epicsStdCall | epicsMutexOsiCreate (const char *pFileName, int lineno) |
Internal API, used by epicsMutexCreate(). More... | |
LIBCOM_API epicsMutexId epicsStdCall | epicsMutexOsiMustCreate (const char *pFileName, int lineno) |
Internal API, used by epicsMutexMustCreate(). More... | |
LIBCOM_API void epicsStdCall | epicsMutexDestroy (epicsMutexId id) |
Destroy an epicsMutex semaphore. More... | |
LIBCOM_API void epicsStdCall | epicsMutexUnlock (epicsMutexId id) |
Release the semaphore. More... | |
LIBCOM_API epicsMutexLockStatus epicsStdCall | epicsMutexLock (epicsMutexId id) |
Claim the semaphore, waiting until it's free if currently owned owned by a different thread. More... | |
LIBCOM_API epicsMutexLockStatus epicsStdCall | epicsMutexTryLock (epicsMutexId id) |
Similar to epicsMutexLock() except that the call returns immediately, with the return status indicating if the semaphore is currently owned by this thread or another thread. More... | |
LIBCOM_API void epicsStdCall | epicsMutexShow (epicsMutexId id, unsigned int level) |
Display information about the semaphore. More... | |
LIBCOM_API void epicsStdCall | epicsMutexShowAll (int onlyLocked, unsigned int level) |
Display information about all epicsMutex semaphores. More... | |
APIs for the epicsMutex mutual exclusion semaphore.
Mutual exclusion semaphores are for situations requiring exclusive access to resources. An epicsMutex may be claimed recursively, i.e. taken more than once by a thread, which must release it as many times as it was taken. Recursive usage is common for a set of routines that call each other while working on an exclusive resource.
The typical C++ use of a mutual exclusion semaphore is:
Definition in file epicsMutex.h.
#define epicsMutexCreate | ( | ) | epicsMutexOsiCreate(__FILE__,__LINE__) |
Create an epicsMutex semaphore for use from C code.
This macro stores the source location of the creation call in the mutex.
Definition at line 168 of file epicsMutex.h.
#define epicsMutexMustCreate | ( | ) | epicsMutexOsiMustCreate(__FILE__,__LINE__) |
Create an epicsMutex semaphore for use from C code.
This macro stores the source location of the creation call in the mutex. The routine does not return if the object could not be created.
Definition at line 179 of file epicsMutex.h.
#define epicsMutexMustLock | ( | ID | ) |
Claim a semaphore (see epicsMutexLock()).
This routine does not return if the identifier is invalid.
ID | The mutex identifier. |
Definition at line 214 of file epicsMutex.h.
typedef struct epicsMutexParm* epicsMutexId |
An identifier for an epicsMutex for use with the C API.
Definition at line 48 of file epicsMutex.h.
enum epicsMutexLockStatus |
Return status from some C API routines.
Enumerator | |
---|---|
epicsMutexLockOK | |
epicsMutexLockTimeout | |
epicsMutexLockError |
Definition at line 51 of file epicsMutex.h.
LIBCOM_API void epicsStdCall epicsMutexDestroy | ( | epicsMutexId | id | ) |
Destroy an epicsMutex semaphore.
id | The mutex identifier. |
Definition at line 127 of file epicsMutex.cpp.
LIBCOM_API epicsMutexLockStatus epicsStdCall epicsMutexLock | ( | epicsMutexId | id | ) |
Claim the semaphore, waiting until it's free if currently owned owned by a different thread.
This call blocks until the calling thread can get exclusive access to the semaphore.
id | The mutex identifier. |
Definition at line 145 of file epicsMutex.cpp.
LIBCOM_API epicsMutexId epicsStdCall epicsMutexOsiCreate | ( | const char * | pFileName, |
int | lineno | ||
) |
Internal API, used by epicsMutexCreate().
Definition at line 85 of file epicsMutex.cpp.
LIBCOM_API epicsMutexId epicsStdCall epicsMutexOsiMustCreate | ( | const char * | pFileName, |
int | lineno | ||
) |
Internal API, used by epicsMutexMustCreate().
Definition at line 119 of file epicsMutex.cpp.
LIBCOM_API void epicsStdCall epicsMutexShow | ( | epicsMutexId | id, |
unsigned int | level | ||
) |
Display information about the semaphore.
id | The mutex identifier. |
level | Desired information level to report |
Definition at line 191 of file epicsMutex.cpp.
LIBCOM_API void epicsStdCall epicsMutexShowAll | ( | int | onlyLocked, |
unsigned int | level | ||
) |
Display information about all epicsMutex semaphores.
onlyLocked | Non-zero to show only locked semaphores. |
level | Desired information level to report |
Definition at line 217 of file epicsMutex.cpp.
LIBCOM_API epicsMutexLockStatus epicsStdCall epicsMutexTryLock | ( | epicsMutexId | id | ) |
Similar to epicsMutexLock() except that the call returns immediately, with the return status indicating if the semaphore is currently owned by this thread or another thread.
epicsMutexLockOK
if the resource is now owned by the caller. epicsMutexLockTimeout
if some other thread owns the resource. Definition at line 158 of file epicsMutex.cpp.
LIBCOM_API void epicsStdCall epicsMutexUnlock | ( | epicsMutexId | id | ) |
Release the semaphore.
id | The mutex identifier. |
Definition at line 140 of file epicsMutex.cpp.