fpmas 1.6
Public Member Functions | List of all members
fpmas::synchro::hard::MutexServer< T > Class Template Reference

#include <mutex_server.h>

Inheritance diagram for fpmas::synchro::hard::MutexServer< T >:
Inheritance graph
[legend]
Collaboration diagram for fpmas::synchro::hard::MutexServer< T >:
Collaboration graph
[legend]

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

- Protected Member Functions inherited from fpmas::synchro::hard::api::MutexServer< T >
void lock (HardSyncMutex< T > *mutex)
 
void lockShared (HardSyncMutex< T > *mutex)
 
void unlock (HardSyncMutex< T > *mutex)
 
void unlockShared (HardSyncMutex< T > *mutex)
 

Detailed Description

template<typename T>
class fpmas::synchro::hard::MutexServer< T >

api::MutexServer implementation.

Constructor & Destructor Documentation

◆ MutexServer()

template<typename T >
fpmas::synchro::hard::MutexServer< T >::MutexServer ( MpiComm comm,
IdMpi id_mpi,
DataMpi data_mpi,
DataUpdateMpi data_update_mpi,
ServerPackBase server_pack 
)
inline

MutexServer constructor.

Parameters
commMPI communicator
id_mpiIdMpi instance
data_mpiDataMpi instance
data_update_mpiDataUpdateMpi instance
server_packthe ServerPack instance used for HardDataSync synchronization.

Member Function Documentation

◆ setEpoch()

template<typename T >
void fpmas::synchro::hard::MutexServer< T >::setEpoch ( api::Epoch  epoch)
inlineoverridevirtual

Sets the current Epoch of the server.

Parameters
epochcurrent Epoch

Implements fpmas::synchro::hard::api::Server.

◆ getEpoch()

template<typename T >
Epoch fpmas::synchro::hard::MutexServer< T >::getEpoch ( ) const
inlineoverridevirtual

Gets the current Epoch of the server.

Returns
current epoch

Implements fpmas::synchro::hard::api::Server.

◆ manage()

template<typename T >
void fpmas::synchro::hard::MutexServer< T >::manage ( DistributedId  id,
HardSyncMutex mutex 
)
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.

Parameters
idid of the node associated to mutex
mutexmutex to manage

Implements fpmas::synchro::hard::api::MutexServer< T >.

◆ remove()

template<typename T >
void fpmas::synchro::hard::MutexServer< T >::remove ( DistributedId  id)
inlineoverridevirtual

Removes the mutex associated to the specified id from the set of managed mutexes.

Parameters
idid of the node associated to the mutex to remove

Implements fpmas::synchro::hard::api::MutexServer< T >.

◆ getManagedMutexes()

template<typename T >
const std::unordered_map< DistributedId, HardSyncMutex * > & fpmas::synchro::hard::MutexServer< T >::getManagedMutexes ( ) const
inline

Returns a map of mutexes managed by this MutexServer.

Returns
managed mutex map

◆ handleIncomingRequests()

template<typename T >
void fpmas::synchro::hard::MutexServer< T >::handleIncomingRequests
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 :

  • read request
  • acquire request
  • given back data

Implements fpmas::synchro::hard::api::Server.

◆ wait()

template<typename T >
void fpmas::synchro::hard::MutexServer< T >::wait ( const Request request)
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.

Parameters
requestrequest to wait for

Implements fpmas::synchro::hard::api::MutexServer< T >.

◆ notify()

template<typename T >
void fpmas::synchro::hard::MutexServer< T >::notify ( DistributedId  id)
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.

Parameters
idid of the node associated to the released mutex

Implements fpmas::synchro::hard::api::MutexServer< T >.


The documentation for this class was generated from the following file: