From: Martin Quinson Date: Mon, 28 Feb 2022 08:14:52 +0000 (+0100) Subject: More information on actor death in monkey's test case X-Git-Tag: v3.31~287 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/67c723e593aeb7d51a39a70bd75bef02199aae60?ds=sidebyside More information on actor death in monkey's test case --- diff --git a/include/xbt/promise.hpp b/include/xbt/promise.hpp index 074853ebf9..09ac8f017d 100644 --- a/include/xbt/promise.hpp +++ b/include/xbt/promise.hpp @@ -1,5 +1,4 @@ -/* 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. */ diff --git a/src/kernel/context/Context.cpp b/src/kernel/context/Context.cpp index 51dd90b561..b20d7869fe 100644 --- a/src/kernel/context/Context.cpp +++ b/src/kernel/context/Context.cpp @@ -141,6 +141,11 @@ void Context::stop() 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 diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index dfba34cf39..0e315e161f 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -66,7 +66,7 @@ public: 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(code_); } diff --git a/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.cpp b/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.cpp index a290e5269a..67a1c104ec 100644 --- a/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.cpp +++ b/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.cpp @@ -40,6 +40,8 @@ static void master(double comp_size, long comm_size) { 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, @@ -63,6 +65,9 @@ static void master(double comp_size, long comm_size) 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);