Class epicsMutex

Class Documentation

class epicsMutex

The C++ API for an epicsMutex.

Public Types

typedef epicsGuard<epicsMutex> guard_t
typedef epicsGuard<epicsMutex> release_t

Public Functions

epicsMutex()

Create a mutual exclusion semaphore.

epicsMutex(const char *pFileName, int lineno)

Create a mutual exclusion semaphore with source location.

Note

The newEpicsMutex macro simplifies using this constructor.

Parameters
  • *pFileName – Source file name.

  • lineno – Source line number

~epicsMutex()

Delete the semaphore and its resources.

void show(unsigned level) const

Display information about the semaphore.

Note

Results are architecture dependent.

Parameters

level – Desired information level to report

void lock()

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.

Note

After a successful lock(), additional recursive locks may be issued by the same thread, but each must have an associated unlock().

void unlock()

Release the semaphore.

Note

If a thread issues recursive locks, it must call unlock() as many times as it calls lock().

bool tryLock()

Similar to lock() except that the call returns immediately if the semaphore is currently owned by another thread, giving the value false.

Returns

True if the resource is now owned by the caller.

Returns

False if some other thread already owns the resource.