A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Convert last bits from the xbt/config C interface.
[simgrid.git]
/
src
/
s4u
/
s4u_mailbox.cpp
diff --git
a/src/s4u/s4u_mailbox.cpp
b/src/s4u/s4u_mailbox.cpp
index
9642de0
..
8d98163
100644
(file)
--- a/
src/s4u/s4u_mailbox.cpp
+++ b/
src/s4u/s4u_mailbox.cpp
@@
-1,13
+1,13
@@
-/* Copyright (c) 2006-201
7
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2006-201
8
. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "simgrid/s4u/Comm.hpp"
#include "simgrid/s4u/Mailbox.hpp"
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "simgrid/s4u/Comm.hpp"
#include "simgrid/s4u/Mailbox.hpp"
-#include "src/msg/msg_private.h"
+#include "src/msg/msg_private.h
pp
"
#include "src/simix/ActorImpl.hpp"
#include "src/simix/ActorImpl.hpp"
-#include "src/simix/smx_network_private.h"
+#include "src/simix/smx_network_private.h
pp
"
#include "xbt/log.h"
XBT_LOG_EXTERNAL_CATEGORY(s4u);
#include "xbt/log.h"
XBT_LOG_EXTERNAL_CATEGORY(s4u);
@@
-16,8
+16,14
@@
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_channel,s4u,"S4U Communication Mailboxes");
namespace simgrid {
namespace s4u {
namespace simgrid {
namespace s4u {
-const char *Mailbox::name() {
- return pimpl_->name_;
+const simgrid::xbt::string& Mailbox::get_name() const
+{
+ return pimpl_->get_name();
+}
+
+const char* Mailbox::get_cname() const
+{
+ return pimpl_->get_cname();
}
MailboxPtr Mailbox::byName(const char*name)
}
MailboxPtr Mailbox::byName(const char*name)
@@
-52,84
+58,89
@@
smx_activity_t Mailbox::front()
}
void Mailbox::setReceiver(ActorPtr actor) {
}
void Mailbox::setReceiver(ActorPtr actor) {
- simix::kernelImmediate([this, actor]() {
- this->pimpl_->setReceiver(actor);
- });
+ simix::kernelImmediate([this, actor]() { this->pimpl_->setReceiver(actor); });
}
/** @brief get the receiver (process associated to the mailbox) */
}
/** @brief get the receiver (process associated to the mailbox) */
-ActorPtr Mailbox::receiver() {
+ActorPtr Mailbox::getReceiver()
+{
if (pimpl_->permanent_receiver == nullptr)
return ActorPtr();
return pimpl_->permanent_receiver->iface();
}
if (pimpl_->permanent_receiver == nullptr)
return ActorPtr();
return pimpl_->permanent_receiver->iface();
}
-CommPtr Mailbox::
send
_init()
+CommPtr Mailbox::
put
_init()
{
CommPtr res = CommPtr(new s4u::Comm());
res->sender_ = SIMIX_process_self();
res->mailbox_ = this;
return res;
}
{
CommPtr res = CommPtr(new s4u::Comm());
res->sender_ = SIMIX_process_self();
res->mailbox_ = this;
return res;
}
-s4u::CommPtr Mailbox::
send_init(void* data, in
t simulatedSize)
+s4u::CommPtr Mailbox::
put_init(void* data, uint64_
t simulatedSize)
{
{
- s4u::CommPtr res =
send
_init();
- res->set
Remains
(simulatedSize);
- res->src
Buff_
= data;
- res->src
BuffS
ize_ = sizeof(void*);
+ s4u::CommPtr res =
put
_init();
+ res->set
_remaining
(simulatedSize);
+ res->src
_buff_
= data;
+ res->src
_buff_s
ize_ = sizeof(void*);
return res;
}
return res;
}
-s4u::CommPtr Mailbox::
send_async(void* data, in
t simulatedSize)
+s4u::CommPtr Mailbox::
put_async(void* payload, uint64_
t simulatedSize)
{
{
- s4u::CommPtr res = send_init(data, simulatedSize);
+ xbt_assert(payload != nullptr, "You cannot send nullptr");
+
+ s4u::CommPtr res = put_init(payload, simulatedSize);
res->start();
return res;
}
res->start();
return res;
}
-void Mailbox::
send(void* payload, double
simulatedSize)
+void Mailbox::
put(void* payload, uint64_t
simulatedSize)
{
{
- CommPtr c = send_init();
- c->setRemains(simulatedSize);
- c->setSrcData(payload);
+ xbt_assert(payload != nullptr, "You cannot send nullptr");
+
+ CommPtr c = put_init();
+ c->set_remaining(simulatedSize);
+ c->set_src_data(payload);
c->wait();
}
/** Blocking send with timeout */
c->wait();
}
/** Blocking send with timeout */
-void Mailbox::
send(void* payload, double
simulatedSize, double timeout)
+void Mailbox::
put(void* payload, uint64_t
simulatedSize, double timeout)
{
{
- CommPtr c = send_init();
- c->setRemains(simulatedSize);
- c->setSrcData(payload);
+ xbt_assert(payload != nullptr, "You cannot send nullptr");
+
+ CommPtr c = put_init();
+ c->set_remaining(simulatedSize);
+ c->set_src_data(payload);
// c->start() is optional.
c->wait(timeout);
}
// c->start() is optional.
c->wait(timeout);
}
-s4u::CommPtr Mailbox::
recv
_init()
+s4u::CommPtr Mailbox::
get
_init()
{
CommPtr res = CommPtr(new s4u::Comm());
res->receiver_ = SIMIX_process_self();
res->mailbox_ = this;
return res;
}
{
CommPtr res = CommPtr(new s4u::Comm());
res->receiver_ = SIMIX_process_self();
res->mailbox_ = this;
return res;
}
-s4u::CommPtr Mailbox::
recv
_async(void** data)
+s4u::CommPtr Mailbox::
get
_async(void** data)
{
{
- s4u::CommPtr res =
recv
_init();
- res->set
DstD
ata(data, sizeof(*data));
+ s4u::CommPtr res =
get
_init();
+ res->set
_dst_d
ata(data, sizeof(*data));
res->start();
return res;
}
res->start();
return res;
}
-void* Mailbox::
recv
()
+void* Mailbox::
get
()
{
void* res = nullptr;
{
void* res = nullptr;
- CommPtr c =
recv
_init();
- c->set
DstD
ata(&res, sizeof(res));
+ CommPtr c =
get
_init();
+ c->set
_dst_d
ata(&res, sizeof(res));
c->wait();
return res;
}
c->wait();
return res;
}
-void* Mailbox::
recv
(double timeout)
+void* Mailbox::
get
(double timeout)
{
void* res = nullptr;
{
void* res = nullptr;
- CommPtr c =
recv
_init();
- c->set
DstD
ata(&res, sizeof(res));
+ CommPtr c =
get
_init();
+ c->set
_dst_d
ata(&res, sizeof(res));
c->wait(timeout);
return res;
}
c->wait(timeout);
return res;
}