if (smx_proc == SIMIX_process_self()) {
/* avoid a SIMIX request if this function is called by the process itself */
msg_proc = (simdata_process_t) SIMIX_process_self_get_data();
if (smx_proc == SIMIX_process_self()) {
/* avoid a SIMIX request if this function is called by the process itself */
msg_proc = (simdata_process_t) SIMIX_process_self_get_data();
*/
msg_process_t MSG_process_create(const char *name, xbt_main_func_t code, void *data, msg_host_t host)
{
*/
msg_process_t MSG_process_create(const char *name, xbt_main_func_t code, void *data, msg_host_t host)
{
- return MSG_process_create_with_environment(name, code, data, host, 0, NULL, NULL);
+ return MSG_process_create_with_environment(name, code, data, host, 0, nullptr, nullptr);
* A constructor for #msg_process_t taking four arguments and returning the corresponding object. The structure (and
* the corresponding thread) is created, and put in the list of ready process.
* A constructor for #msg_process_t taking four arguments and returning the corresponding object. The structure (and
* the corresponding thread) is created, and put in the list of ready process.
* \param code is a function describing the behavior of the process. It should then only use functions described
* in \ref m_process_management (to create a new #msg_process_t for example),
in \ref m_host_management (only the read-only functions i.e. whose name contains the word get),
in \ref m_task_management (to create or destroy some #msg_task_t for example) and
in \ref msg_task_usage (to handle file transfers and task processing).
* \param data a pointer to any data one may want to attach to the new object. It is for user-level information and
* \param code is a function describing the behavior of the process. It should then only use functions described
* in \ref m_process_management (to create a new #msg_process_t for example),
in \ref m_host_management (only the read-only functions i.e. whose name contains the word get),
in \ref m_task_management (to create or destroy some #msg_task_t for example) and
in \ref msg_task_usage (to handle file transfers and task processing).
* \param data a pointer to any data one may want to attach to the new object. It is for user-level information and
* \param host the location where the new process is executed.
* \param argc first argument passed to \a code
* \param argv second argument passed to \a code
* \param host the location where the new process is executed.
* \param argc first argument passed to \a code
* \param argv second argument passed to \a code
msg_process_t MSG_process_create_with_arguments(const char *name, xbt_main_func_t code, void *data, msg_host_t host,
int argc, char **argv)
{
msg_process_t MSG_process_create_with_arguments(const char *name, xbt_main_func_t code, void *data, msg_host_t host,
int argc, char **argv)
{
- return MSG_process_create_with_environment(name, code, data, host, argc, argv, NULL);
+ return MSG_process_create_with_environment(name, code, data, host, argc, argv, nullptr);
* A constructor for #msg_process_t taking four arguments and returning the corresponding object. The structure (and
* the corresponding thread) is created, and put in the list of ready process.
* A constructor for #msg_process_t taking four arguments and returning the corresponding object. The structure (and
* the corresponding thread) is created, and put in the list of ready process.
* \param code is a function describing the behavior of the process. It should then only use functions described
* in \ref m_process_management (to create a new #msg_process_t for example),
in \ref m_host_management (only the read-only functions i.e. whose name contains the word get),
in \ref m_task_management (to create or destroy some #msg_task_t for example) and
in \ref msg_task_usage (to handle file transfers and task processing).
* \param data a pointer to any data one may want to attach to the new object. It is for user-level information and
* \param code is a function describing the behavior of the process. It should then only use functions described
* in \ref m_process_management (to create a new #msg_process_t for example),
in \ref m_host_management (only the read-only functions i.e. whose name contains the word get),
in \ref m_task_management (to create or destroy some #msg_task_t for example) and
in \ref msg_task_usage (to handle file transfers and task processing).
* \param data a pointer to any data one may want to attach to the new object. It is for user-level information and
* \param host the location where the new process is executed.
* \param argc first argument passed to \a code
* \param argv second argument passed to \a code. WARNING, these strings are freed by the SimGrid kernel when the
* \param host the location where the new process is executed.
* \param argc first argument passed to \a code
* \param argv second argument passed to \a code. WARNING, these strings are freed by the SimGrid kernel when the
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)
{
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)
{
- code ? simgrid::xbt::wrapMain(code, argc, argv) : std::function<void()>(),
- data, host,
- properties);
+ std::move(function), data, host, properties);
const char *name, std::function<void()> code, void *data,
msg_host_t host, xbt_dict_t properties)
{
const char *name, std::function<void()> code, void *data,
msg_host_t host, xbt_dict_t properties)
{
simdata_process_t simdata = xbt_new0(s_simdata_process_t, 1);
msg_process_t process;
/* Simulator data for MSG */
simdata_process_t simdata = xbt_new0(s_simdata_process_t, 1);
msg_process_t process;
/* Simulator data for MSG */
*/
msg_process_t MSG_process_attach(const char *name, void *data, msg_host_t host, xbt_dict_t properties)
{
*/
msg_process_t MSG_process_attach(const char *name, void *data, msg_host_t host, xbt_dict_t properties)
{
simdata_process_t simdata = xbt_new0(s_simdata_process_t, 1);
msg_process_t process;
/* Simulator data for MSG */
simdata_process_t simdata = xbt_new0(s_simdata_process_t, 1);
msg_process_t process;
/* Simulator data for MSG */
simdata->m_host = host;
simdata->data = data;
simdata->last_errno = MSG_OK;
/* Let's create the process: SIMIX may decide to start it right now, even before returning the flow control to us */
simdata->m_host = host;
simdata->data = data;
simdata->last_errno = MSG_OK;
/* Let's create the process: SIMIX may decide to start it right now, even before returning the flow control to us */
- process = SIMIX_process_attach(name, simdata, sg_host_get_name(host), properties, NULL);
+ process = SIMIX_process_attach(name, simdata, sg_host_get_name(host), properties, nullptr);
if (!process)
xbt_die("Could not attach");
simcall_process_on_exit(process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,process);
if (!process)
xbt_die("Could not attach");
simcall_process_on_exit(process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,process);
/* get from SIMIX the MSG process data, and then the user data */
simdata_process_t simdata = (simdata_process_t) simcall_process_get_data(process);
if (simdata)
return simdata->data;
else
/* get from SIMIX the MSG process data, and then the user data */
simdata_process_t simdata = (simdata_process_t) simcall_process_get_data(process);
if (simdata)
return simdata->data;
else
/** \ingroup m_process_management
* \brief Sets a cleanup function to be called to free the userdata of a process when a process is destroyed.
/** \ingroup m_process_management
* \brief Sets a cleanup function to be called to free the userdata of a process when a process is destroyed.
*/
XBT_PUBLIC(void) MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup) {
msg_global->process_data_cleanup = data_cleanup;
*/
XBT_PUBLIC(void) MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup) {
msg_global->process_data_cleanup = data_cleanup;
* \return the msg_host_t corresponding to the location on which \a process is running.
*/
msg_host_t MSG_process_get_host(msg_process_t process)
{
simdata_process_t simdata;
* \return the msg_host_t corresponding to the location on which \a process is running.
*/
msg_host_t MSG_process_get_host(msg_process_t process)
{
simdata_process_t simdata;
simdata = (simdata_process_t) SIMIX_process_self_get_data();
}
else {
simdata = (simdata_process_t) simcall_process_get_data(process);
}
simdata = (simdata_process_t) SIMIX_process_self_get_data();
}
else {
simdata = (simdata_process_t) simcall_process_get_data(process);
}
* \brief Return a #msg_process_t given its PID.
*
* This function search in the list of all the created msg_process_t for a msg_process_t whose PID is equal to \a PID.
* \brief Return a #msg_process_t given its PID.
*
* This function search in the list of all the created msg_process_t for a msg_process_t whose PID is equal to \a PID.
Note that the PID are uniq in the whole simulation, not only on a given host.
*/
msg_process_t MSG_process_from_PID(int PID)
Note that the PID are uniq in the whole simulation, not only on a given host.
*/
msg_process_t MSG_process_from_PID(int PID)
{
/* 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 */
{
/* 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 */