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
hide pimpl a bit in the high level API
[simgrid.git]
/
teshsuite
/
s4u
/
listen_async
/
listen_async.cpp
diff --git
a/teshsuite/s4u/listen_async/listen_async.cpp
b/teshsuite/s4u/listen_async/listen_async.cpp
index
9cae4a2
..
19a31c9
100644
(file)
--- a/
teshsuite/s4u/listen_async/listen_async.cpp
+++ b/
teshsuite/s4u/listen_async/listen_async.cpp
@@
-17,25
+17,26
@@
static void server()
{
simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("mailbox");
- simgrid::s4u::
this_actor::isend(mailbox,
xbt_strdup("Some data"), 0);
+ simgrid::s4u::
CommPtr sendComm = mailbox->put_async(
xbt_strdup("Some data"), 0);
xbt_assert(mailbox->listen()); // True (1)
XBT_INFO("Task listen works on regular mailboxes");
- char* res = static_cast<char*>(
simgrid::s4u::this_actor::recv(mailbox
));
+ char* res = static_cast<char*>(
mailbox->get(
));
xbt_assert(not strcmp("Some data", res), "Data received: %s", res);
XBT_INFO("Data successfully received from regular mailbox");
xbt_free(res);
+ sendComm->wait();
simgrid::s4u::MailboxPtr mailbox2 = simgrid::s4u::Mailbox::byName("mailbox2");
mailbox2->setReceiver(simgrid::s4u::Actor::self());
-
simgrid::s4u::this_actor::isend(mailbox2, xbt_strdup("More data"), 0
);
+
mailbox2->put_init(xbt_strdup("More data"), 0)->detach(
);
xbt_assert(mailbox2->listen()); // used to break.
XBT_INFO("Task listen works on asynchronous mailboxes");
- res = static_cast<char*>(
simgrid::s4u::this_actor::recv(mailbox2
));
+ res = static_cast<char*>(
mailbox2->get(
));
xbt_assert(not strcmp("More data", res));
xbt_free(res);
@@
-44,11
+45,12
@@
static void server()
int main(int argc, char* argv[])
{
- simgrid::s4u::Engine
* e = new simgrid::s4u::Engin
e(&argc, argv);
- e
->
loadPlatform(argv[1]);
+ simgrid::s4u::Engine
e(&argc, argv);
+ e
.
loadPlatform(argv[1]);
simgrid::s4u::Actor::createActor("test", simgrid::s4u::Host::by_name("Tremblay"), server);
- e->run();
+ e.run();
+
return 0;
}