- return res;
-}
-
-SG_END_DECL()
-
-msg_process_t MSG_process_create_from_stdfunc(const char* name, std::function<void()> code, void* data, msg_host_t host,
- xbt_dict_t properties)
-{
- xbt_assert(code != nullptr && host != nullptr, "Invalid parameters: host and code params must not be nullptr");
- simgrid::msg::ActorExt* msgExt = new simgrid::msg::ActorExt(data);
-
- smx_actor_t process = simcall_process_create(name, std::move(code), msgExt, host, properties);
-
- if (not process) { /* Undo everything */
- delete msgExt;
- return nullptr;
- }
-
- simcall_process_on_exit(process, (int_f_pvoid_pvoid_t)TRACE_msg_process_kill, process);
- return process->ciface();
-}
-
-SG_BEGIN_DECL()
-
-/* Become a process in the simulation
- *
- * Currently this can only be called by the main thread (once) and only work with some thread factories
- * (currently ThreadContextFactory).
- *
- * In the future, it might be extended in order to attach other threads created by a third party library.
- */
-msg_process_t MSG_process_attach(const char *name, void *data, msg_host_t host, xbt_dict_t properties)
-{
- xbt_assert(host != nullptr, "Invalid parameters: host and code params must not be nullptr");
-
- /* Let's create the process: SIMIX may decide to start it right now, even before returning the flow control to us */
- smx_actor_t process =
- SIMIX_process_attach(name, new simgrid::msg::ActorExt(data), host->cname(), properties, nullptr);
- if (not process)
- xbt_die("Could not attach");
- simcall_process_on_exit(process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,process);
- return process->ciface();
-}
-
-/** Detach a process attached with `MSG_process_attach()`
- *
- * This is called when the current process has finished its job.
- * Used in the main thread, it waits for the simulation to finish before returning. When it returns, the other
- * simulated processes and the maestro are destroyed.
- */
-void MSG_process_detach()
-{
- SIMIX_process_detach();
-}
-
-/** \ingroup m_process_management
- * \param process poor victim
- *
- * This function simply kills a \a process... scary isn't it ? :)
- */
-void MSG_process_kill(msg_process_t process)
-{
- simcall_process_kill(process->getImpl());
-}
-
-/**
-* \brief Wait for the completion of a #msg_process_t.
-*
-* \param process the process to wait for
-* \param timeout wait until the process is over, or the timeout occurs
-*/
-msg_error_t MSG_process_join(msg_process_t process, double timeout){
- simcall_process_join(process->getImpl(), timeout);
- return MSG_OK;
-}
-
-/** \ingroup m_process_management
- * \brief Migrates a process to another location.
- *
- * This function checks whether \a process and \a host are valid pointers and change the value of the #msg_host_t on
- * which \a process is running.
- */
-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);
- process->migrate(host);
- return MSG_OK;
-}