#include "xbt/sysdep.h"
#include "xbt/log.h"
#include "xbt/functional.hpp"
-#include "src/simix/smx_process_private.h"
+#include "src/simix/ActorImpl.hpp"
#include "src/simix/smx_private.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg, "Logging specific to MSG (process)");
msg_process_t MSG_process_create_with_environment(const char *name, xbt_main_func_t code, void *data, msg_host_t host,
int argc, char **argv, xbt_dict_t properties)
{
+ std::function<void()> function;
+ if (code)
+ function = simgrid::xbt::wrapMain(code, argc, const_cast<const char*const*>(argv));
msg_process_t res = MSG_process_create_with_environment(name,
- code ? simgrid::xbt::wrapMain(code, argc, argv) : std::function<void()>(),
- data, host,
- properties);
+ std::move(function), data, host, properties);
for (int i = 0; i != argc; ++i)
xbt_free(argv[i]);
xbt_free(argv);
{
/* Do not raise an exception here: this function is called by the logs
* and the exceptions, so it would be called back again and again */
- if (process == nullptr) {
+ if (process == nullptr)
return 0;
- }
- return simcall_process_get_PID(process);
+ return process->pid;
}
/** \ingroup m_process_management
*/
int MSG_process_get_PPID(msg_process_t process)
{
- xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr");
- return simcall_process_get_PPID(process);
+ return process->ppid;
}
/** \ingroup m_process_management
*/
const char *MSG_process_get_name(msg_process_t process)
{
- xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr");
- return simcall_process_get_name(process);
+ return process->name.c_str();
}
/** \ingroup m_process_management
TRACE_msg_process_suspend(process);
simcall_process_suspend(process);
- MSG_RETURN(MSG_OK);
+ return MSG_OK;
}
/** \ingroup m_process_management
TRACE_msg_process_resume(process);
simcall_process_resume(process);
- MSG_RETURN(MSG_OK);
+ return MSG_OK;
}
/** \ingroup m_process_management