/* 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. */
static void producer(SharedBuffer& buf)
{
static int todo = cfg_item_count; // remaining amount of items to exchange
static void producer(SharedBuffer& buf)
{
static int todo = cfg_item_count; // remaining amount of items to exchange
bool rebooting = sg4::Actor::self()->get_restart_count() > 0;
XBT_INFO("Producer %s", rebooting ? "rebooting" : "booting");
if (not rebooting) // Starting for the first time
sg4::this_actor::on_exit(
[](bool forcefully) { XBT_INFO("Producer dying %s.", forcefully ? "forcefully" : "peacefully"); });
bool rebooting = sg4::Actor::self()->get_restart_count() > 0;
XBT_INFO("Producer %s", rebooting ? "rebooting" : "booting");
if (not rebooting) // Starting for the first time
sg4::this_actor::on_exit(
[](bool forcefully) { XBT_INFO("Producer dying %s.", forcefully ? "forcefully" : "peacefully"); });
bool rebooting = sg4::Actor::self()->get_restart_count() > 0;
XBT_INFO("Consumer %s", rebooting ? "rebooting" : "booting");
if (not rebooting) // Starting for the first time
sg4::this_actor::on_exit(
[](bool forcefully) { XBT_INFO("Consumer dying %s.", forcefully ? "forcefully" : "peacefully"); });
bool rebooting = sg4::Actor::self()->get_restart_count() > 0;
XBT_INFO("Consumer %s", rebooting ? "rebooting" : "booting");
if (not rebooting) // Starting for the first time
sg4::this_actor::on_exit(
[](bool forcefully) { XBT_INFO("Consumer dying %s.", forcefully ? "forcefully" : "peacefully"); });
to_release.push(buf.sem_full);
sg4::this_actor::sleep_for(0.75); // Give a chance to the monkey to kill this actor at this point
to_release.push(buf.sem_full);
sg4::this_actor::sleep_for(0.75); // Give a chance to the monkey to kill this actor at this point