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
Use typed Mailbox::get<>() instead of using static_cast everywhere.
[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
8002e01
..
04e7ac4
100644
(file)
--- a/
teshsuite/s4u/listen_async/listen_async.cpp
+++ b/
teshsuite/s4u/listen_async/listen_async.cpp
@@
-21,7
+21,10
@@
static void server()
xbt_assert(mailbox->listen()); // True (1)
XBT_INFO("Task listen works on regular mailboxes");
xbt_assert(mailbox->listen()); // True (1)
XBT_INFO("Task listen works on regular mailboxes");
- const std::string* res = static_cast<std::string*>(mailbox->get());
+ XBT_INFO("Mailbox::listen_from() returns %ld (should return my pid, which is %ld)", mailbox->listen_from(),
+ simgrid::s4u::this_actor::get_pid());
+
+ const std::string* res = mailbox->get<std::string>();
xbt_assert(*res == "Some data", "Data received: %s", res->c_str());
XBT_INFO("Data successfully received from regular mailbox");
xbt_assert(*res == "Some data", "Data received: %s", res->c_str());
XBT_INFO("Data successfully received from regular mailbox");
@@
-36,7
+39,7
@@
static void server()
xbt_assert(mailbox2->listen()); // used to break.
XBT_INFO("Task listen works on asynchronous mailboxes");
xbt_assert(mailbox2->listen()); // used to break.
XBT_INFO("Task listen works on asynchronous mailboxes");
- res =
static_cast<std::string*>(mailbox2->get()
);
+ res =
mailbox2->get<std::string>(
);
xbt_assert(*res == "More data");
delete res;
xbt_assert(*res == "More data");
delete res;