![]() |
fpmas 1.6
|
#include <hard_sync_mutex.h>
Public Member Functions | |
HardSyncMutex (fpmas::api::graph::DistributedNode< T > *node, MutexClient &mutex_client, MutexServer &mutex_server) | |
void | pushRequest (Request request) override |
std::queue< Request > | requestsToProcess () override |
T & | data () override |
const T & | data () const override |
const T & | read () override |
void | releaseRead () override |
T & | acquire () override |
void | releaseAcquire () override |
void | lock () override |
void | unlock () override |
bool | locked () const override |
void | lockShared () override |
void | unlockShared () override |
int | sharedLockCount () const override |
void | synchronize () override |
virtual void | pushRequest (MutexRequest request)=0 |
virtual std::queue< MutexRequest > | requestsToProcess ()=0 |
virtual T & | data ()=0 |
virtual const T & | data () const =0 |
virtual const T & | read ()=0 |
virtual void | releaseRead ()=0 |
virtual T & | acquire ()=0 |
virtual void | releaseAcquire ()=0 |
virtual void | lock ()=0 |
virtual void | unlock ()=0 |
virtual bool | locked () const =0 |
virtual void | lockShared ()=0 |
virtual void | unlockShared ()=0 |
virtual int | sharedLockCount () const =0 |
virtual void | synchronize ()=0 |
Additional Inherited Members | |
virtual void | _lock ()=0 |
virtual void | _lockShared ()=0 |
virtual void | _unlock ()=0 |
virtual void | _unlockShared ()=0 |
HardSyncMode Mutex implementation.
Each operation is added to a queue and potentially transmitted to DISTANT processes to ensure a strict global concurrent access management.
|
inline |
HardSyncMutex constructor.
node | node associated to this mutex |
mutex_client | client used to transmit requests to other processes |
mutex_server | server used to handle incoming mutex requests |
|
overridevirtual |
Pushes a pending request into the waiting queue.
request | mutex request to push |
Implements fpmas::synchro::hard::api::HardSyncMutex< T >.
|
overridevirtual |
Returns an ordered list of requests that can be handled, depending on the current mutex status.
For example, if the mutex is locked, an empty queue might be returned. Else, read or lock shared requests can be returned, until the next pending acquire or lock request.
In any case, the exact behavior is implementation defined and might depend about what priority is given to each request. (e.g. : https://en.wikipedia.org/wiki/Readers%E2%80%93writers_problem)
Implements fpmas::synchro::hard::api::HardSyncMutex< T >.
|
inlineoverridevirtual |
Direct access to internal data representation.
Does not guarantee any concurrent access or data update management.
Implements fpmas::api::synchro::Mutex< T >.
|
inlineoverridevirtual |
Direct access to internal data representation.
Does not guarantee any concurrent access or data update management.
Implements fpmas::api::synchro::Mutex< T >.
|
overridevirtual |
Provides a read access to the internal data.
The functions blocks until data is effectively read.
Read data must be released using releaseRead().
Implements fpmas::api::synchro::Mutex< T >.
|
overridevirtual |
Releases a mutex previously accessed with read().
Implements fpmas::api::synchro::Mutex< T >.
|
overridevirtual |
Releases a mutex previously accessed with acquire().
Semantically, this operation also "commits" eventual write operations that were performed on the acquired data. However, the actual behavior is implementation defined.
Implements fpmas::api::synchro::Mutex< T >.
|
overridevirtual |
Releases a mutex previously accessed with acquire().
Semantically, this operation also "commits" eventual write operations that were performed on the acquired data. However, the actual behavior is implementation defined.
Implements fpmas::api::synchro::Mutex< T >.
|
overridevirtual |
Locks the mutex.
This function blocks until internal data is effectively locked. Upon return, an exclusive access to the internal data is guaranteed. However, contrary to the acquire() function, this operation does not involve any data update or write operation handling.
A locked mutex must be unlocked using unlock().
Implements fpmas::api::synchro::Mutex< T >.
|
overridevirtual |
Unlocks a mutex previously locked with lock().
Implements fpmas::api::synchro::Mutex< T >.
|
inlineoverridevirtual |
Returns true if and only if the mutex has been locked and not yet unlocked.
Implements fpmas::api::synchro::Mutex< T >.
|
overridevirtual |
Obtains a shared lock access to the mutex.
This function blocks until a shared lock access to mutex is effectively obtained. Contrary to lock(), multiple threads are allowed to simultaneously obtain a shared lock to the mutex.
The mutex must then be unlocked using unlockShared().
Implements fpmas::api::synchro::Mutex< T >.
|
overridevirtual |
Unlocks a mutex previously locked with lockShared().
Semantically, all threads that called lockShared() must call unlockShared() to finally unlock the mutex.
Implements fpmas::api::synchro::Mutex< T >.
|
inlineoverridevirtual |
Returns the count of threads that currently own a shared lock access to the mutex.
Implements fpmas::api::synchro::Mutex< T >.
|
inlineoverridevirtual |
Method eventually called when data synchronization is performed on this Mutex.
The behavior of this method depends on the currently implemented SynchronizationMode.
Implements fpmas::api::synchro::Mutex< T >.