wrench::S4U_PendingCommunication

class S4U_PendingCommunication

This is a simple wrapper class around S4U asynchronous communication checking methods.

Public Types

enum OperationType

The communication operation’s type.

Values:

enumerator SENDING
enumerator RECEIVING

Public Functions

inline S4U_PendingCommunication(S4U_CommPort *commport, OperationType operation_type)

Constructor.

Parameters:
  • commport – the CommPort

  • operation_type – the operation type

std::unique_ptr<SimulationMessage> wait()

Wait for the pending communication to complete.

Throws:

std::shared_ptr<NetworkError>

Returns:

A (unique pointer to a) simulation message

std::unique_ptr<SimulationMessage> wait(double timeout)

Wait for the pending communication to complete with a timeout.

Parameters:

timeout – a timeout in seconds

Throws:

std::shared_ptr<NetworkError>

Returns:

A (unique pointer to a) simulation message

Public Members

simgrid::s4u::CommPtr comm_ptr

The SimGrid Mailbox communication handle.

S4U_CommPort *commport

The CommPort.

simgrid::s4u::MessPtr mess_ptr

The SimGrid MessageQueue communication handle.

OperationType operation_type

The operation type.

std::unique_ptr<SimulationMessage> simulation_message

The message.

Public Static Functions

static unsigned long waitForSomethingToHappen(const std::vector<std::shared_ptr<S4U_PendingCommunication>> &pending_comms, double timeout)

Wait for any pending communication completion.

Parameters:
  • pending_comms – a list of pending communications

  • timeout – timeout value in seconds (-1 means no timeout)

Throws:

std::invalid_argument

Returns:

the index of the comm to which something happened (success or failure)

static unsigned long waitForSomethingToHappen(std::vector<S4U_PendingCommunication*> pending_comms, double timeout)

Wait for any pending communication completion.

Parameters:
  • pending_comms – a list of pending communications

  • timeout – timeout value in seconds (-1 means no timeout)

Throws:

std::invalid_argument

Returns:

the index of the comm to which something happened (success or failure), or ULONG_MAX if nothing happened before the timeout expired.