OnixS C++ CME iLink 3 Binary Order Entry Handler 1.18.9
API Documentation
Loading...
Searching...
No Matches
Mutex Class Reference

Public Member Functions

 Mutex ()
 ~Mutex ()
void acquire ()
bool tryAcquire ()
void release ()

Friends

class Condition

Detailed Description

Protects resources from simultaneous access by multiple threads.

Only one thread at a time can own instance of this class.

This implementation is optimized for locking threads that are in the same process.

Note
It is NOT suitable for interprocess synchronization.
Recursive locking is NOT supported.

Definition at line 39 of file Mutex.h.

Constructor & Destructor Documentation

◆ Mutex()

Mutex ( )

Initializes the instance.

◆ ~Mutex()

~Mutex ( )

Destructs the instance.

Member Function Documentation

◆ acquire()

void acquire ( )

Acquires the lock ownership.

If the mutex is already occupied by another thread blocks the current thread and waits until it will be released by the owner.

◆ release()

void release ( )

Releases the ownership (lock) and unblocks one of the waiting threads.

◆ tryAcquire()

bool tryAcquire ( )

Tries to acquires the lock ownership.

Returns
false if the mutex is already occupied by another thread, otherwise - true.

◆ Condition

friend class Condition
friend

Definition at line 42 of file Mutex.h.