+ s4u::CommPtr res = put_init(payload, simulatedSize);
+ res->start();
+ return res;
+}
+void Mailbox::put(void* payload, uint64_t simulatedSize)
+{
+ xbt_assert(payload != nullptr, "You cannot send nullptr");
+
+ CommPtr c = put_init();
+ c->setRemains(simulatedSize);
+ c->setSrcData(payload);
+ c->wait();
+}
+/** Blocking send with timeout */
+void Mailbox::put(void* payload, uint64_t simulatedSize, double timeout)
+{
+ xbt_assert(payload != nullptr, "You cannot send nullptr");
+
+ CommPtr c = put_init();
+ c->setRemains(simulatedSize);
+ c->setSrcData(payload);
+ // c->start() is optional.
+ c->wait(timeout);
+}
+
+s4u::CommPtr Mailbox::get_init()
+{
+ CommPtr res = CommPtr(new s4u::Comm());
+ res->receiver_ = SIMIX_process_self();
+ res->mailbox_ = this;
+ return res;
+}
+s4u::CommPtr Mailbox::get_async(void** data)
+{
+ s4u::CommPtr res = get_init();
+ res->setDstData(data, sizeof(*data));
+ res->start();
+ return res;
+}