#include "src/kernel/activity/SynchroRaw.hpp"
#include "src/mc/mc_record.hpp"
#include "src/mc/mc_replay.hpp"
-#include "src/simix/smx_host_private.hpp"
#include "src/simix/smx_private.hpp"
#include "src/surf/StorageImpl.hpp"
#include "src/surf/xml/platf.hpp"
std::raise(signum);
}
-char sigsegv_stack[SIGSTKSZ]; /* alternate stack for SIGSEGV handler */
+unsigned char sigsegv_stack[SIGSTKSZ]; /* alternate stack for SIGSEGV handler */
/**
* Install signal handler for SIGSEGV. Check that nobody has already installed
namespace simgrid {
namespace simix {
-Timer* Timer::set(double date, void (*callback)(void*), void* arg)
-{
- Timer* timer = new Timer(date, simgrid::xbt::make_task([callback, arg]() { callback(arg); }));
- timer->handle_ = simix_timers.emplace(std::make_pair(date, timer));
- return timer;
-}
-
-Timer* Timer::set(double date, simgrid::xbt::Task<void()> callback)
+Timer* Timer::set(double date, simgrid::xbt::Task<void()>&& callback)
{
Timer* timer = new Timer(date, std::move(callback));
timer->handle_ = simix_timers.emplace(std::make_pair(date, timer));
#endif
if (simix_global == nullptr) {
- simix_global = std::unique_ptr<simgrid::simix::Global>(new simgrid::simix::Global());
+ simix_global.reset(new simgrid::simix::Global());
simix_global->maestro_process = nullptr;
surf_init(argc, argv); /* Initialize SURF structures */
#endif
/* Let's free maestro now */
- delete simix_global->maestro_process->context_;
- simix_global->maestro_process->context_ = nullptr;
delete simix_global->maestro_process;
simix_global->maestro_process = nullptr;
if (simix_global->tasks.empty())
return false;
- using std::swap;
do {
// We don't want the callbacks to modify the vector we are iterating over:
- swap(simix_global->tasks, simix_global->tasksTemp);
+ simix_global->tasks.swap(simix_global->tasksTemp);
// Execute all the queued tasks:
for (auto& task : simix_global->tasksTemp)
smx_timer_t SIMIX_timer_set(double date, void (*callback)(void*), void *arg)
{
- return simgrid::simix::Timer::set(date, callback, arg);
+ return simgrid::simix::Timer::set(date, std::bind(callback, arg));
}
-smx_timer_t SIMIX_timer_set(double date, simgrid::xbt::Task<void()> callback)
+smx_timer_t SIMIX_timer_set(double date, simgrid::xbt::Task<void()>&& callback) // deprecated
{
- smx_timer_t timer = new simgrid::simix::Timer(date, std::move(callback));
- timer->handle_ = simgrid::simix::simix_timers.emplace(std::make_pair(date, timer));
- return timer;
+ return simgrid::simix::Timer::set(date, std::move(callback));
}
/** @brief cancels a timer that was added earlier */