/** @brief Resume the actor. */
XBT_PUBLIC(void) resume();
- XBT_PUBLIC(int) isSuspended();
+ XBT_PUBLIC(bool) isSuspended();
/** @brief kill the actor. */
XBT_PUBLIC(void) kill();
/* Getters and Setters */
XBT_PUBLIC(int) simcall_process_count();
XBT_PUBLIC(void) simcall_process_set_data(smx_actor_t process, void *data);
-XBT_PUBLIC(void) simcall_process_set_host(smx_actor_t process, sg_host_t dest);
-XBT_PUBLIC(int) simcall_process_is_suspended(smx_actor_t process);
XBT_PUBLIC(xbt_dict_t) simcall_process_get_properties(smx_actor_t host);
XBT_PUBLIC(void) simcall_process_set_kill_time(smx_actor_t process, double kill_time);
XBT_PUBLIC(double) simcall_process_get_kill_time(smx_actor_t process);
msg_error_t MSG_process_migrate(msg_process_t process, msg_host_t host)
{
TRACE_msg_process_change_host(process, MSG_process_get_host(process), host);
- simcall_process_set_host(process->getImpl(), host);
+ process->migrate(host);
return MSG_OK;
}
*/
int MSG_process_is_suspended(msg_process_t process)
{
- return simcall_process_is_suspended(process->getImpl());
+ return process->isSuspended();
}
smx_context_t MSG_process_get_smx_ctx(msg_process_t process) {
void Actor::migrate(Host* new_host)
{
- simcall_process_set_host(pimpl_, new_host);
+ simgrid::simix::kernelImmediate([this, new_host]() { pimpl_->new_host = new_host; });
}
s4u::Host* Actor::host()
int Actor::isSuspended()
{
- return simcall_process_is_suspended(pimpl_);
+ return simgrid::simix::kernelImmediate([this]() { return pimpl_->suspended; });
}
void Actor::setKillTime(double time) {
simcall_process_resume(SIMIX_process_self());
}
-int isSuspended()
+bool isSuspended()
{
- return simcall_process_is_suspended(SIMIX_process_self());
+ smx_actor_t process = SIMIX_process_self();
+ return simgrid::simix::kernelImmediate([process] { return process->suspended; });
}
void kill()
void migrate(Host* new_host)
{
- simcall_process_set_host(SIMIX_process_self(), new_host);
+ smx_actor_t process = SIMIX_process_self();
+ simgrid::simix::kernelImmediate([process, new_host] { process->new_host = new_host; });
}
}
}
SIMIX_process_empty_trash();
}
-void simcall_HANDLER_process_set_host(smx_simcall_t simcall, smx_actor_t process, sg_host_t dest)
-{
- process->new_host = dest;
-}
-
void SIMIX_process_change_host(smx_actor_t process, sg_host_t dest)
{
xbt_assert((process != nullptr), "Invalid parameters");
simcall_BODY_process_cleanup(process);
}
-/**
- * \ingroup simix_process_management
- * \brief Migrates an agent to another location.
- *
- * This function changes the value of the host on which \a process is running.
- *
- * \param process the process to migrate
- * \param dest name of the new host
- */
-void simcall_process_set_host(smx_actor_t process, sg_host_t dest)
-{
- simcall_BODY_process_set_host(process, dest);
-}
-
void simcall_process_join(smx_actor_t process, double timeout)
{
simcall_BODY_process_join(process, timeout);
return SIMIX_timer_get_date(process->kill_timer);
}
-/**
- * \ingroup simix_process_management
- * \brief Returns true if the process is suspended .
- *
- * This checks whether a process is suspended or not by inspecting the task on which it was waiting for the completion.
- * \param process SIMIX process
- * \return 1, if the process is suspended, else 0.
- */
-int simcall_process_is_suspended(smx_actor_t process)
-{
- return simcall_BODY_process_is_suspended(process);
-}
-
/**
* \ingroup simix_process_management
* \brief Return the properties
simgrid::simix::marshal<smx_actor_t>(simcall->args[0], arg);
}
-static inline smx_actor_t simcall_process_set_host__get__process(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]);
-}
-static inline smx_actor_t simcall_process_set_host__getraw__process(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_actor_t>(simcall->args[0]);
-}
-static inline void simcall_process_set_host__set__process(smx_simcall_t simcall, smx_actor_t arg)
-{
- simgrid::simix::marshal<smx_actor_t>(simcall->args[0], arg);
-}
-static inline sg_host_t simcall_process_set_host__get__dest(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<sg_host_t>(simcall->args[1]);
-}
-static inline sg_host_t simcall_process_set_host__getraw__dest(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<sg_host_t>(simcall->args[1]);
-}
-static inline void simcall_process_set_host__set__dest(smx_simcall_t simcall, sg_host_t arg)
-{
- simgrid::simix::marshal<sg_host_t>(simcall->args[1], arg);
-}
-
-static inline smx_actor_t simcall_process_is_suspended__get__process(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]);
-}
-static inline smx_actor_t simcall_process_is_suspended__getraw__process(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_actor_t>(simcall->args[0]);
-}
-static inline void simcall_process_is_suspended__set__process(smx_simcall_t simcall, smx_actor_t arg)
-{
- simgrid::simix::marshal<smx_actor_t>(simcall->args[0], arg);
-}
-static inline int simcall_process_is_suspended__get__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<int>(simcall->result);
-}
-static inline int simcall_process_is_suspended__getraw__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<int>(simcall->result);
-}
-static inline void simcall_process_is_suspended__set__result(smx_simcall_t simcall, int result){
- simgrid::simix::marshal<int>(simcall->result, result);
-}
-
static inline smx_actor_t simcall_process_join__get__process(smx_simcall_t simcall)
{
return simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]);
XBT_PRIVATE void simcall_HANDLER_process_kill(smx_simcall_t simcall, smx_actor_t process);
XBT_PRIVATE void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid);
XBT_PRIVATE void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t process);
-XBT_PRIVATE void simcall_HANDLER_process_set_host(smx_simcall_t simcall, smx_actor_t process, sg_host_t dest);
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 boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
return simcall<void, smx_actor_t>(SIMCALL_PROCESS_RESUME, process);
}
-inline static void simcall_BODY_process_set_host(smx_actor_t process, sg_host_t dest) {
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) simcall_HANDLER_process_set_host(&SIMIX_process_self()->simcall, process, dest);
- return simcall<void, smx_actor_t, sg_host_t>(SIMCALL_PROCESS_SET_HOST, process, dest);
- }
-
-inline static int simcall_BODY_process_is_suspended(smx_actor_t process) {
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) SIMIX_process_is_suspended(process);
- return simcall<int, smx_actor_t>(SIMCALL_PROCESS_IS_SUSPENDED, process);
- }
-
inline static int simcall_BODY_process_join(smx_actor_t process, double timeout) {
/* Go to that function to follow the code flow through the simcall barrier */
if (0) simcall_HANDLER_process_join(&SIMIX_process_self()->simcall, process, timeout);
SIMCALL_PROCESS_CLEANUP,
SIMCALL_PROCESS_SUSPEND,
SIMCALL_PROCESS_RESUME,
- SIMCALL_PROCESS_SET_HOST,
- SIMCALL_PROCESS_IS_SUSPENDED,
SIMCALL_PROCESS_JOIN,
SIMCALL_PROCESS_SLEEP,
SIMCALL_EXECUTION_START,
"SIMCALL_PROCESS_CLEANUP",
"SIMCALL_PROCESS_SUSPEND",
"SIMCALL_PROCESS_RESUME",
- "SIMCALL_PROCESS_SET_HOST",
- "SIMCALL_PROCESS_IS_SUSPENDED",
"SIMCALL_PROCESS_JOIN",
"SIMCALL_PROCESS_SLEEP",
"SIMCALL_EXECUTION_START",
SIMIX_simcall_answer(simcall);
break;
-case SIMCALL_PROCESS_SET_HOST:
- simcall_HANDLER_process_set_host(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_host_t>(simcall->args[1]));
- SIMIX_simcall_answer(simcall);
- break;
-
-case SIMCALL_PROCESS_IS_SUSPENDED:
- simgrid::simix::marshal<int>(simcall->result, SIMIX_process_is_suspended(simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0])));
- SIMIX_simcall_answer(simcall);
- 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;
# int foo(int x, int y) [[nohandler]];
# int foo(int x, int y) [[block, nohandler]];
#
-# The `block` attribut is used for calls which do not return in the same
+# The `block` attribute is used for calls which do not return in the same
# scheduling round. The answer requires some interaction with SURF,
-# even if this can still occure at the same timestamp under some
-# circonstances (eg if the surf_action cannot start because of resources
+# even if this can still occur at the same timestamp under some
+# circumstances (eg if the surf_action cannot start because of resources
# that are down) examples: things that last some time (communicate, execute,
# mutex_lock).
#
# by the kernel.
# The only remaining use of that mechanism is to add the caller
# identity as a parameter of internal call, but that could be
-# automatized too (eg by having a special parameter type called "self")
+# automated too (eg by having a special parameter type called "self")
# Please note that in addition to completing this file with your new simcall,
# you should complete the libsmx.c file by adding the corresponding function
-# (aka. stub). Anyway, if you omit to do it, the invocation of ./simcalls.py will notify you ;)
+# (a.k.a. stub). Anyway, if you omit to do it, the invocation of ./simcalls.py will notify you ;)
# If you want to remove an handler, it is important to remove although
# the corresponding code (simcall_HANDLER_name_of_simcall(xxx) (note that comment the code
# is not sufficient, the python script does not check whether the code is commented or not).
# Last but not the least, you should declare the new simix call in
-# ./include/simgrid/simix.h (otherwise you will get a warning at the
-# compilation time)
+# ./include/simgrid/simix.h (otherwise you will get a warning at compile time)
void process_kill(smx_actor_t process);
void process_killall(int reset_pid);
void process_cleanup(smx_actor_t process) [[nohandler]];
void process_suspend(smx_actor_t process) [[block]];
void process_resume(smx_actor_t process) [[nohandler]];
-void process_set_host(smx_actor_t process, sg_host_t dest);
-int process_is_suspended(smx_actor_t process) [[nohandler]];
int process_join(smx_actor_t process, double timeout) [[block]];
int process_sleep(double duration) [[block]];