-/* Copyright (c) 2015-2022. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2015-2022. 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->actor_->cleanup();
}
+void Context::set_wannadie(bool value)
+{
+ XBT_DEBUG("Actor %s gonna die.", actor_->get_cname());
+ iwannadie_ = value;
+}
AttachContext::~AttachContext() = default;
} // namespace context
virtual ~Context();
bool wannadie() const { return iwannadie_; }
- void set_wannadie(bool value = true) { iwannadie_ = value; }
+ void set_wannadie(bool value = true);
bool is_maestro() const { return is_maestro_; }
void operator()() const { code_(); }
bool has_code() const { return static_cast<bool>(code_); }
{
XBT_INFO("Master booting");
sg4::Actor::self()->daemonize();
+ sg4::this_actor::on_exit(
+ [](bool forcefully) { XBT_INFO("Master dying %s.", forcefully ? "forcefully" : "peacefully"); });
while (true) { // This is a daemon
xbt_assert(sg4::Engine::get_clock() < cfg_deadline,
static void worker(int id)
{
XBT_INFO("Worker booting");
+ sg4::this_actor::on_exit(
+ [id](bool forcefully) { XBT_INFO("worker %d dying %s.", id, forcefully ? "forcefully" : "peacefully"); });
+
while (todo > 0) {
xbt_assert(sg4::Engine::get_clock() < cfg_deadline,
"Failed to run all tasks in less than %d seconds. Is this an infinite loop?", (int)cfg_deadline);