void simcall_process_set_data(smx_actor_t process, void* data);
/* Process handling */
XBT_PUBLIC void simcall_process_suspend(smx_actor_t process);
-XBT_PUBLIC void simcall_process_join(smx_actor_t process, double timeout);
+
+XBT_ATTRIB_DEPRECATED_v327("Please use Actor::join()") XBT_PUBLIC
+ void simcall_process_join(smx_actor_t process, double timeout);
/* Sleep control */
XBT_PUBLIC e_smx_state_t simcall_process_sleep(double duration);
return process->get_cname();
}
-void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t actor, double timeout)
-{
- if (actor->finished_) {
- // The joined process is already finished, just wake up the issuer process right away
- simcall_process_sleep__set__result(simcall, SIMIX_DONE);
- simcall->issuer->simcall_answer();
- return;
- }
- smx_activity_t sync = simcall->issuer->join(actor, timeout);
- sync->simcalls_.push_back(simcall);
- simcall->issuer->waiting_synchro = sync;
-}
-
void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration)
{
if (MC_is_active() || MC_record_replay_is_active()) {
void Actor::join()
{
- simcall_process_join(this->pimpl_, -1);
+ join(-1);
}
void Actor::join(double timeout)
{
- simcall_process_join(this->pimpl_, timeout);
+ auto issuer = SIMIX_process_self();
+ auto target = pimpl_;
+ simix::simcall_blocking([issuer, target, timeout] {
+ if (target->finished_) {
+ // The joined process is already finished, just wake up the issuer right away
+ issuer->simcall_answer();
+ } else {
+ smx_activity_t sync = issuer->join(target, timeout);
+ sync->simcalls_.push_back(&issuer->simcall);
+ issuer->waiting_synchro = sync;
+ }
+ });
}
void Actor::set_auto_restart(bool autorestart)
void simcall_process_join(smx_actor_t process, double timeout)
{
- simcall_BODY_process_join(process, timeout);
+ SIMIX_process_self()->join(process, timeout);
}
/**
simgrid::simix::marshal<smx_actor_t>(simcall->args[0], arg);
}
-static inline smx_actor_t simcall_process_join__get__process(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]);
-}
-static inline smx_actor_t simcall_process_join__getraw__process(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_actor_t>(simcall->args[0]);
-}
-static inline void simcall_process_join__set__process(smx_simcall_t simcall, smx_actor_t arg)
-{
- simgrid::simix::marshal<smx_actor_t>(simcall->args[0], arg);
-}
-static inline double simcall_process_join__get__timeout(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<double>(simcall->args[1]);
-}
-static inline double simcall_process_join__getraw__timeout(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<double>(simcall->args[1]);
-}
-static inline void simcall_process_join__set__timeout(smx_simcall_t simcall, double arg)
-{
- simgrid::simix::marshal<double>(simcall->args[1], arg);
-}
-static inline int simcall_process_join__get__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<int>(simcall->result);
-}
-static inline int simcall_process_join__getraw__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<int>(simcall->result);
-}
-static inline void simcall_process_join__set__result(smx_simcall_t simcall, int result)
-{
- simgrid::simix::marshal<int>(simcall->result, result);
-}
-
static inline double simcall_process_sleep__get__duration(smx_simcall_t simcall)
{
return simgrid::simix::unmarshal<double>(simcall->args[0]);
/* The prototype of all simcall handlers, automatically generated for you */
XBT_PRIVATE void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t process);
-XBT_PRIVATE void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t process, double timeout);
XBT_PRIVATE void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration);
XBT_PRIVATE void simcall_HANDLER_execution_wait(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* execution);
XBT_PRIVATE void simcall_HANDLER_execution_waitany_for(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl** execs, size_t count, double timeout);
return simcall<void, smx_actor_t>(SIMCALL_PROCESS_SUSPEND, process);
}
-inline static int simcall_BODY_process_join(smx_actor_t process, double timeout)
-{
- if (0) /* Go to that function to follow the code flow through the simcall barrier */
- simcall_HANDLER_process_join(&SIMIX_process_self()->simcall, process, timeout);
- return simcall<int, smx_actor_t, double>(SIMCALL_PROCESS_JOIN, process, timeout);
-}
-
inline static int simcall_BODY_process_sleep(double duration)
{
if (0) /* Go to that function to follow the code flow through the simcall barrier */
typedef enum {
SIMCALL_NONE,
SIMCALL_PROCESS_SUSPEND,
- SIMCALL_PROCESS_JOIN,
SIMCALL_PROCESS_SLEEP,
SIMCALL_EXECUTION_WAIT,
SIMCALL_EXECUTION_WAITANY_FOR,
const char* simcall_names[] = {
"SIMCALL_NONE",
"SIMCALL_PROCESS_SUSPEND",
- "SIMCALL_PROCESS_JOIN",
"SIMCALL_PROCESS_SLEEP",
"SIMCALL_EXECUTION_WAIT",
"SIMCALL_EXECUTION_WAITANY_FOR",
simcall_HANDLER_process_suspend(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]));
break;
- case SIMCALL_PROCESS_JOIN:
- simcall_HANDLER_process_join(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]), simgrid::simix::unmarshal<double>(simcall.args[1]));
- break;
-
case SIMCALL_PROCESS_SLEEP:
simcall_HANDLER_process_sleep(&simcall, simgrid::simix::unmarshal<double>(simcall.args[0]));
break;
# ./include/simgrid/simix.h (otherwise you will get a warning at compile time)
void process_suspend(smx_actor_t process) [[block]];
-int process_join(smx_actor_t process, double timeout) [[block]];
int process_sleep(double duration) [[block]];
int execution_wait(simgrid::kernel::activity::ExecImpl* execution) [[block]];