OnixS C++ FIX Engine 4.14.0
Users' manual and API documentation
Loading...
Searching...
No Matches
Mutex Class Reference

#include <OnixS/FIXEngine/Threading/Mutex.h>

Public Member Functions

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

Friends

friend ONIXS_FIXENGINE_API_DECL (class, Condition)

Detailed Description

Protects a resources from the simultaneous access by multiple threads.

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

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

Note
It is NOT suitable for use for the interprocess synchronization.
The recursive locking is NOT supported.

Definition at line 34 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 already occupied by the other 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 waiting threads.

◆ tryAcquire()

bool tryAcquire ( )

Acquires the lock ownership if the Mutex is not owned by any thread. If the Mutex is already owned by the other thread, returns false. In either cases it doesn't block thread and quites immediately.

◆ ONIXS_FIXENGINE_API_DECL

ONIXS_FIXENGINE_API_DECL ( class ,
Condition  )
friend