A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bummer. Fix borken commit.
[simgrid.git]
/
src
/
simix
/
smx_process.cpp
diff --git
a/src/simix/smx_process.cpp
b/src/simix/smx_process.cpp
index
d7654ef
..
bb91a10
100644
(file)
--- a/
src/simix/smx_process.cpp
+++ b/
src/simix/smx_process.cpp
@@
-76,6
+76,7
@@
void SIMIX_process_cleanup(smx_process_t process)
XBT_DEBUG("Cleanup process %s (%p), waiting synchro %p",
process->name.c_str(), process, process->waiting_synchro);
XBT_DEBUG("Cleanup process %s (%p), waiting synchro %p",
process->name.c_str(), process, process->waiting_synchro);
+ process->finished = true;
SIMIX_process_on_exit_runall(process);
/* Unregister from the kill timer if any */
SIMIX_process_on_exit_runall(process);
/* Unregister from the kill timer if any */
@@
-203,6
+204,7
@@
void SIMIX_maestro_create(void (*code)(void*), void* data)
* and stops its context.
*/
void SIMIX_process_stop(smx_process_t arg) {
* and stops its context.
*/
void SIMIX_process_stop(smx_process_t arg) {
+ arg->finished = true;
/* execute the on_exit functions */
SIMIX_process_on_exit_runall(arg);
/* Add the process to the list of process to restart, only if the host is down */
/* execute the on_exit functions */
SIMIX_process_on_exit_runall(arg);
/* Add the process to the list of process to restart, only if the host is down */
@@
-751,6
+753,12
@@
xbt_dict_t SIMIX_process_get_properties(smx_process_t process)
void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_process_t process, double timeout)
{
void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_process_t process, double timeout)
{
+ if (process->finished) {
+ // 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;
+ }
smx_synchro_t sync = SIMIX_process_join(simcall->issuer, process, timeout);
sync->simcalls.push_back(simcall);
simcall->issuer->waiting_synchro = sync;
smx_synchro_t sync = SIMIX_process_join(simcall->issuer, process, timeout);
sync->simcalls.push_back(simcall);
simcall->issuer->waiting_synchro = sync;
@@
-778,13
+786,14
@@
static int SIMIX_process_join_finish(smx_process_exit_status_t status, smx_synch
sleep->surf_sleep->unref();
sleep->surf_sleep = nullptr;
}
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);
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;
}
SIMIX_process_on_exit(process, (int_f_pvoid_pvoid_t)SIMIX_process_join_finish, res);
return res;
}
@@
-827,6
+836,7
@@
void SIMIX_process_sleep_destroy(smx_synchro_t synchro)
if (sleep->surf_sleep) {
sleep->surf_sleep->unref();
sleep->surf_sleep = nullptr;
if (sleep->surf_sleep) {
sleep->surf_sleep->unref();
sleep->surf_sleep = nullptr;
+ sleep->unref();
}
}
}
}
@@
-1041,7
+1051,7
@@
smx_process_t simcall_process_create(
if (name == nullptr)
name = "";
smx_process_t self = SIMIX_process_self();
if (name == nullptr)
name = "";
smx_process_t self = SIMIX_process_self();
- return simgrid::simix::kernel([&] {
+ return simgrid::simix::kernel
Immediate
([&] {
return SIMIX_process_create(name,
std::move(code), data, hostname,
kill_time, properties, auto_restart,
return SIMIX_process_create(name,
std::move(code), data, hostname,
kill_time, properties, auto_restart,