![]() |
fpmas 1.6
|
#include <mutex_server.h>
Public Member Functions | |
MutexServer (MpiComm &comm, IdMpi &id_mpi, DataMpi &data_mpi, DataUpdateMpi &data_update_mpi, ServerPackBase &server_pack) | |
void | setEpoch (api::Epoch e) override |
Epoch | getEpoch () const override |
void | manage (DistributedId id, HardSyncMutex *mutex) override |
void | remove (DistributedId id) override |
const std::unordered_map< DistributedId, HardSyncMutex * > & | getManagedMutexes () const |
void | handleIncomingRequests () override |
void | wait (const Request &) override |
void | notify (DistributedId) override |
virtual void | manage (DistributedId id, HardSyncMutex< T > *mutex)=0 |
virtual void | remove (DistributedId id)=0 |
virtual void | wait (const MutexRequest &request)=0 |
virtual void | notify (DistributedId id)=0 |
virtual void | setEpoch (Epoch epoch)=0 |
virtual Epoch | getEpoch () const =0 |
virtual void | handleIncomingRequests ()=0 |
Additional Inherited Members | |
![]() | |
void | lock (HardSyncMutex< T > *mutex) |
void | lockShared (HardSyncMutex< T > *mutex) |
void | unlock (HardSyncMutex< T > *mutex) |
void | unlockShared (HardSyncMutex< T > *mutex) |
api::MutexServer implementation.
|
inline |
MutexServer constructor.
comm | MPI communicator |
id_mpi | IdMpi instance |
data_mpi | DataMpi instance |
data_update_mpi | DataUpdateMpi instance |
server_pack | the ServerPack instance used for HardDataSync synchronization. |
|
inlineoverridevirtual |
Sets the current Epoch of the server.
epoch | current Epoch |
Implements fpmas::synchro::hard::api::Server.
|
inlineoverridevirtual |
Gets the current Epoch of the server.
Implements fpmas::synchro::hard::api::Server.
|
inlineoverridevirtual |
Adds the provided mutex
, associated to the resource id
, to the current set of managed mutexes.
A mutex is "managed" means that the MutexServer instance is able to receive and handle requests involving this mutex.
id | id of the node associated to mutex |
mutex | mutex to manage |
Implements fpmas::synchro::hard::api::MutexServer< T >.
|
inlineoverridevirtual |
Removes the mutex associated to the specified id from the set of managed mutexes.
id | id of the node associated to the mutex to remove |
Implements fpmas::synchro::hard::api::MutexServer< T >.
|
inline |
Returns a map of mutexes managed by this MutexServer.
|
overridevirtual |
Performs a reception cycle to handle.
This function should not be used by the user, but is left public because it might be useful for unit testing.
A call to this function will receive and handle at most one of each of the following requests types :
Implements fpmas::synchro::hard::api::Server.
|
overridevirtual |
Waits for the specified request to be handled.
This is notably used in a single-threaded environment from the main thread, where the argument request
is a request performed by the local process. Indeed, the local process cannot directly access its own resources, since they might be acquired by other processes. To solve this issue, the HardSyncMutex adds a "LOCAL" request to its waiting queue, and "waits" for this request to be handled by the MutexServer to get back to its main execution thread. While "waiting", the MutexServer keeps handling and unqueueing pending requests until the specified request
is reached.
request | request to wait for |
Implements fpmas::synchro::hard::api::MutexServer< T >.
|
overridevirtual |
Notifies the MutexServer that the local process has released the local mutex associated to the provided id.
This is used to trigger pending requests handling.
id | id of the node associated to the released mutex |
Implements fpmas::synchro::hard::api::MutexServer< T >.