- simgrid::kernel::actor::ActorImpl::detach();
-}
-
-smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostname,
- std::unordered_map<std::string, std::string>* properties,
- smx_actor_t /*parent_process*/)
-{
- return simgrid::kernel::actor::ActorImpl::attach(name, data, sg_host_by_name(hostname), properties).get();
-}
-
-/** @deprecated When this function gets removed, also remove the xbt_ex class, that is only there to help users to
- * transition */
-void SIMIX_process_throw(smx_actor_t actor, xbt_errcat_t cat, int value, const char* msg)
-{
- xbt_ex e(XBT_THROW_POINT, msg);
- e.category = cat;
- e.value = value;
- actor->throw_exception(std::make_exception_ptr(e));
-}
-
-void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t actor)
-{
- smx_activity_t sync_suspend = actor->suspend(simcall->issuer);
-
- if (actor != simcall->issuer) {
- SIMIX_simcall_answer(simcall);
- } else {
- sync_suspend->simcalls_.push_back(simcall);
- actor->waiting_synchro = sync_suspend;
- actor->waiting_synchro->suspend();
- }
- /* If we are suspending ourselves, then just do not finish the simcall now */
-}
-
-int SIMIX_process_get_maxpid()
-{
- return simix_process_maxpid;
-}
-
-int SIMIX_process_count()
-{
- return simix_global->process_list.size();
-}
-
-void* SIMIX_process_self_get_data() // deprecated
-{
- smx_actor_t self = SIMIX_process_self();
-
- if (self == nullptr) {
- return nullptr;
- }
- return self->get_user_data();
-}
-
-void SIMIX_process_self_set_data(void* data) // deprecated
-{
- SIMIX_process_self()->set_user_data(data);
-}
-
-/* needs to be public and without simcall because it is called
- by exceptions and logging events */
-const char* SIMIX_process_self_get_name()
-{
-
- smx_actor_t process = SIMIX_process_self();
- if (process == nullptr || process == simix_global->maestro_process)
- return "maestro";
-
- return process->get_cname();
-}
-
-void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_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_activity_t sync = simcall->issuer->join(process, 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()) {
- MC_process_clock_add(simcall->issuer, duration);
- simcall_process_sleep__set__result(simcall, SIMIX_DONE);
- SIMIX_simcall_answer(simcall);
- return;
- }
- smx_activity_t sync = simcall->issuer->sleep(duration);
- sync->simcalls_.push_back(simcall);
- simcall->issuer->waiting_synchro = sync;
-}
-
-/**
- * @brief Calling this function makes the process to yield.
- *
- * Only the current process can call this function, giving back the control to maestro.
- *
- * @param self the current process
- */
-
-/** @brief Returns the list of processes to run.
- * @deprecated
- */
-const std::vector<smx_actor_t>& simgrid::simix::process_get_runnable()
-{
- return simix_global->actors_to_run;
-}
-
-/** @brief Returns the process from PID. */
-smx_actor_t SIMIX_process_from_PID(aid_t PID)
-{
- auto actor = simix_global->process_list.find(PID);
- return actor == simix_global->process_list.end() ? nullptr : actor->second;
-}
-
-void SIMIX_process_on_exit(smx_actor_t actor, int_f_pvoid_pvoid_t fun, void* data)
-{
- SIMIX_process_on_exit(actor, [fun, data](bool failed) {
- intptr_t status = failed ? SMX_EXIT_FAILURE : SMX_EXIT_SUCCESS;
- fun(reinterpret_cast<void*>(status), data);
- });
-}
-
-void SIMIX_process_on_exit(smx_actor_t actor, const std::function<void(int, void*)>& fun, void* data)
-{
- SIMIX_process_on_exit(actor, [fun, data](bool failed) { fun(failed ? SMX_EXIT_FAILURE : SMX_EXIT_SUCCESS, data); });
-}
-
-void SIMIX_process_on_exit(smx_actor_t actor, const std::function<void(bool /*failed*/)>& fun)
-{
- xbt_assert(actor, "current process not found: are you in maestro context ?");
- actor->on_exit.emplace_back(fun);
-}
-
-/** @brief Restart a process, starting it again from the beginning. */
-/**
- * @ingroup simix_process_management
- * @brief Creates and runs a new SIMIX process.
- *
- * The structure and the corresponding thread are created and put in the list of ready processes.
- *
- * @param name a name for the process. It is for user-level information and can be nullptr.
- * @param code the main function of the process
- * @param data a pointer to any data one may want to attach to the new object. It is for user-level information and can
- * be nullptr.
- * It can be retrieved with the method ActorImpl::getUserData().
- * @param host where the new agent is executed.
- * @param properties the properties of the process
- */
-smx_actor_t simcall_process_create(const std::string& name, const simgrid::simix::ActorCode& code, void* data,
- sg_host_t host, std::unordered_map<std::string, std::string>* properties)
-{
- smx_actor_t self = SIMIX_process_self();
- return simgrid::simix::simcall([&name, &code, data, host, properties, self] {
- return simgrid::kernel::actor::ActorImpl::create(name, code, data, host, properties, self).get();
- });