gramods
Classes | Public Member Functions | List of all members
gramods::gmNetwork::RunSync Class Reference

Execution synchronization over network, i.e. More...

#include <RunSync.hh>

Inheritance diagram for gramods::gmNetwork::RunSync:
Inheritance graph
[legend]
Collaboration diagram for gramods::gmNetwork::RunSync:
Collaboration graph
[legend]

Classes

struct  Impl
 

Public Member Functions

void wait ()
 Waits until all peers have called this method. More...
 
void processMessage (Message m) override
 Counts the number of peers that have called waitForAll and releases the waiting thread when all peers have notified this. More...
 
void lostPeer (size_t idx) override
 Called by the sync node when connection to one of the peers has been broken. More...
 
char getProtocolFlag () override
 Returns the header byte associated with the protocol, sent in the header of messages to indicate which protocol instance to call for interpretation and processing. More...
 
- Public Member Functions inherited from gramods::gmNetwork::Protocol
void setSyncNode (SyncNode *sync_node)
 

Additional Inherited Members

- Static Public Attributes inherited from gramods::gmNetwork::Protocol
static const size_t HEADER_LENGTH = Message().getHeader().size()
 
- Protected Member Functions inherited from gramods::gmNetwork::Protocol
void sendMessage (std::vector< char > data)
 Convenience method for creating a message and sending this to all peers. More...
 
size_t getLocalPeerIdx ()
 Convenience method for quering the SyncNode for the local peer idx. More...
 
std::set< size_t > getConnectedPeers ()
 Convenience method for quering the SyncNode for the currently connected peers. More...
 
- Protected Attributes inherited from gramods::gmNetwork::Protocol
SyncNodesync_node
 The SyncNode instance this protocol communicates through or nullptr if it has gone out of scope. More...
 
std::mutex sync_node_lock
 Lock for synchronizing the sync_node pointer. More...
 

Detailed Description

Execution synchronization over network, i.e.

barrier.

Member Function Documentation

◆ getProtocolFlag()

char gramods::gmNetwork::RunSync::getProtocolFlag ( )
inlineoverridevirtual

Returns the header byte associated with the protocol, sent in the header of messages to indicate which protocol instance to call for interpretation and processing.

Reimplemented from gramods::gmNetwork::Protocol.

◆ lostPeer()

void gramods::gmNetwork::RunSync::lostPeer ( size_t  idx)
overridevirtual

Called by the sync node when connection to one of the peers has been broken.

Reimplemented from gramods::gmNetwork::Protocol.

◆ processMessage()

void gramods::gmNetwork::RunSync::processMessage ( Message  m)
overridevirtual

Counts the number of peers that have called waitForAll and releases the waiting thread when all peers have notified this.

Reimplemented from gramods::gmNetwork::Protocol.

◆ wait()

void gramods::gmNetwork::RunSync::wait ( )

Waits until all peers have called this method.

It is up to the client code to avoid deadlock or contention, and make sure that it is the same call that synchronizes.


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