gramods
|
Execution synchronization over network, i.e. More...
#include <RunSync.hh>
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... | |
![]() | |
void | setSyncNode (SyncNode *sync_node) |
Additional Inherited Members | |
![]() | |
static const size_t | HEADER_LENGTH = Message().getHeader().size() |
![]() | |
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... | |
![]() | |
SyncNode * | sync_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... | |
Execution synchronization over network, i.e.
barrier.
|
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.
|
overridevirtual |
Called by the sync node when connection to one of the peers has been broken.
Reimplemented from gramods::gmNetwork::Protocol.
|
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.
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.