wrench::S4U_Mailbox

class wrench::S4U_Mailbox

Wrappers around S4U’s communication methods.

Public Static Functions

static void createMailboxPool(unsigned long num_mailboxes)

Create the pool of mailboxes to use.

Parameters

num_mailboxes – numb mailboxes in pool

static void dputMessage(simgrid::s4u::Mailbox *mailbox, SimulationMessage *msg)

Asynchronously send a message to a mailbox in a “fire and forget” fashion.

Parameters
static simgrid::s4u::Mailbox *generateUniqueMailbox(std::string prefix)

Generate a unique (non-temporary) mailbox.

Parameters

prefix – mailbox name prefix

Returns

static unsigned long generateUniqueSequenceNumber()

Generate a unique sequence number.

Returns

a unique sequence number

static std::unique_ptr<SimulationMessage> getMessage(simgrid::s4u::Mailbox *mailbox)

Synchronously receive a message from a mailbox.

Parameters

mailbox – the mailbox

Throws

std::shared_ptr<NetworkError>

Returns

the message, or nullptr (in which case it’s likely a brutal termination)

static std::unique_ptr<SimulationMessage> getMessage(simgrid::s4u::Mailbox *mailbox, double timeout)

Synchronously receive a message from a mailbox, with a timeout.

Parameters
  • mailbox – the mailbox

  • timeout – a timeout value in seconds (<0 means never timeout)

Throws

std::shared_ptr<NetworkError>

Returns

the message, or nullptr (in which case it’s likely a brutal termination)

static simgrid::s4u::Mailbox *getTemporaryMailbox()

Get a temporary mailbox.

Returns

a temporary mailbox

static std::shared_ptr<S4U_PendingCommunication> igetMessage(simgrid::s4u::Mailbox *mailbox)

Asynchronously receive a message from a mailbox.

Parameters

mailbox – the mailbox

Throws

std::shared_ptr<NetworkError>

Returns

a pending communication handle

static std::shared_ptr<S4U_PendingCommunication> iputMessage(simgrid::s4u::Mailbox *mailbox, SimulationMessage *msg)

Asynchronously send a message to a mailbox.

Parameters
Throws

std::shared_ptr<NetworkError>

Returns

a pending communication handle

static void putMessage(simgrid::s4u::Mailbox *mailbox, SimulationMessage *m)

Synchronously send a message to a mailbox.

Parameters
Throws

std::shared_ptr<NetworkError>

static void retireTemporaryMailbox(simgrid::s4u::Mailbox *mailbox)

Retire a temporary mailbox.

Parameters

mailbox – the mailbox to retire

Public Static Attributes

static unsigned long mailbox_pool_size

The mailbox pool size.