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
Fix some tesh after changing dependence relation about Semaphore
[simgrid.git]
/
teshsuite
/
s4u
/
actor-suspend
/
actor-suspend.cpp
diff --git
a/teshsuite/s4u/actor-suspend/actor-suspend.cpp
b/teshsuite/s4u/actor-suspend/actor-suspend.cpp
index 167313ef3be11322f2111d2ee8f619fe0969ce71..91aad4daa1b7c2d22d28d66cbaa6153f9bebfa84 100644
(file)
--- a/
teshsuite/s4u/actor-suspend/actor-suspend.cpp
+++ b/
teshsuite/s4u/actor-suspend/actor-suspend.cpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2020-202
1
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2020-202
3
. 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. */
/* 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. */
@@
-14,21
+14,23
@@
XBT_LOG_NEW_DEFAULT_CATEGORY(mwe, "Minimum Working Example");
XBT_LOG_NEW_DEFAULT_CATEGORY(mwe, "Minimum Working Example");
-simgrid::s4u::ActorPtr receiver;
-
class Receiver {
public:
void operator()() const
{
XBT_INFO("Starting.");
class Receiver {
public:
void operator()() const
{
XBT_INFO("Starting.");
- auto mailbox = simgrid::s4u::Mailbox::by_name("receiver");
+ auto
*
mailbox = simgrid::s4u::Mailbox::by_name("receiver");
int data = *mailbox->get<int>();
XBT_INFO("Got %d at the end", data);
}
};
class Suspender {
int data = *mailbox->get<int>();
XBT_INFO("Got %d at the end", data);
}
};
class Suspender {
+ const simgrid::s4u::ActorPtr& receiver;
+
public:
public:
+ explicit Suspender(const simgrid::s4u::ActorPtr& receiver) : receiver(receiver) {}
+
void operator()() const
{
XBT_INFO("Suspend the receiver...");
void operator()() const
{
XBT_INFO("Suspend the receiver...");
@@
-40,7
+42,7
@@
public:
simgrid::s4u::this_actor::sleep_for(10);
XBT_INFO("Sending a message to the receiver...");
simgrid::s4u::this_actor::sleep_for(10);
XBT_INFO("Sending a message to the receiver...");
- auto
mailbox
= simgrid::s4u::Mailbox::by_name("receiver");
+ auto
* mailbox
= simgrid::s4u::Mailbox::by_name("receiver");
static int data = 42;
mailbox->put(&data, 4);
static int data = 42;
mailbox->put(&data, 4);
@@
-53,9
+55,10
@@
int main(int argc, char** argv)
simgrid::s4u::Engine engine(&argc, argv);
engine.load_platform(argv[1]);
simgrid::s4u::Engine engine(&argc, argv);
engine.load_platform(argv[1]);
- simgrid::s4u::Host* host =
simgrid::s4u::Host::
by_name("Tremblay");
+ simgrid::s4u::Host* host =
engine.host_
by_name("Tremblay");
- simgrid::s4u::Actor::create("Suspender", host, Suspender());
+ simgrid::s4u::ActorPtr receiver;
+ simgrid::s4u::Actor::create("Suspender", host, Suspender(receiver));
receiver = simgrid::s4u::Actor::create("Receiver", host, Receiver());
engine.run();
receiver = simgrid::s4u::Actor::create("Receiver", host, Receiver());
engine.run();