/* 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. */
+#include <exception>
+#include <functional>
+#include <string>
+#include <utility>
+
#include <boost/range/algorithm.hpp>
#include <xbt/functional.hpp>
+#include <xbt/ex.hpp>
+#include <xbt/sysdep.h>
+#include <xbt/log.h>
+#include <xbt/dict.h>
+
+#include <simgrid/s4u/host.hpp>
+
+#include <mc/mc.h>
#include "src/surf/surf_interface.hpp"
#include "smx_private.h"
-#include "xbt/sysdep.h"
-#include "xbt/log.h"
-#include "xbt/dict.h"
-#include "mc/mc.h"
#include "src/mc/mc_replay.h"
#include "src/mc/Client.hpp"
#include "src/msg/msg_private.h"
-
#include "src/simix/SynchroSleep.hpp"
#include "src/simix/SynchroRaw.hpp"
#include "src/simix/SynchroIo.hpp"
void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_process_t process, double timeout)
{
if (process->finished) {
- // The process is already finished, just wake up the process right now:
+ // The joined process is already finished, just wake up the issuer process right away
simcall_process_sleep__set__result(simcall, SIMIX_DONE);
SIMIX_simcall_answer(simcall);
return;
sleep->surf_sleep->unref();
sleep->surf_sleep = nullptr;
}
- delete sleep;
+ sleep->unref();
return 0;
}
smx_synchro_t SIMIX_process_join(smx_process_t issuer, smx_process_t process, double timeout)
{
smx_synchro_t res = SIMIX_process_sleep(issuer, timeout);
+ static_cast<simgrid::simix::Synchro*>(res)->ref();
SIMIX_process_on_exit(process, (int_f_pvoid_pvoid_t)SIMIX_process_join_finish, res);
return res;
}
if (sleep->surf_sleep) {
sleep->surf_sleep->unref();
sleep->surf_sleep = nullptr;
+ sleep->unref();
}
}