1 /* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "simgrid/Exception.hpp"
8 #include "smx_private.hpp"
9 #include "src/kernel/activity/CommImpl.hpp"
10 #include "src/kernel/activity/ExecImpl.hpp"
11 #include "src/kernel/activity/IoImpl.hpp"
12 #include "src/kernel/activity/SleepImpl.hpp"
13 #include "src/kernel/activity/SynchroRaw.hpp"
14 #include "src/mc/mc_replay.hpp"
15 #include "src/mc/remote/Client.hpp"
16 #include "src/simix/smx_host_private.hpp"
17 #include "src/simix/smx_io_private.hpp"
18 #include "src/simix/smx_synchro_private.hpp"
19 #include "src/surf/HostImpl.hpp"
20 #include "src/surf/cpu_interface.hpp"
22 #include <boost/range/algorithm.hpp>
24 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_process, simix, "Logging specific to SIMIX (process)");
26 static unsigned long simix_process_maxpid = 0;
29 * @brief Returns the current agent.
31 * This functions returns the currently running SIMIX process.
33 * @return The SIMIX process
35 smx_actor_t SIMIX_process_self()
37 smx_context_t self_context = simgrid::kernel::context::Context::self();
39 return (self_context != nullptr) ? self_context->get_actor() : nullptr;
43 * @brief Returns whether a process has pending asynchronous communications.
44 * @return true if there are asynchronous communications in this process
46 int SIMIX_process_has_pending_comms(smx_actor_t process) {
48 return process->comms.size() > 0;
52 * @brief Moves a process to the list of processes to destroy.
54 void SIMIX_process_cleanup(smx_actor_t process)
56 XBT_DEBUG("Cleanup process %s (%p), waiting synchro %p", process->get_cname(), process,
57 process->waiting_synchro.get());
59 simix_global->mutex.lock();
61 simix_global->process_list.erase(process->pid_);
62 if (process->host_ && process->host_process_list_hook.is_linked())
63 simgrid::xbt::intrusive_erase(process->host_->pimpl_->process_list_, *process);
64 if (not process->smx_destroy_list_hook.is_linked()) {
66 xbt_dynar_push_as(simix_global->dead_actors_vector, smx_actor_t, process);
68 simix_global->process_to_destroy.push_back(*process);
70 process->context_->iwannadie = false;
72 simix_global->mutex.unlock();
78 * Should be called some time to time to free the memory allocated for processes that have finished (or killed).
80 void SIMIX_process_empty_trash()
82 while (not simix_global->process_to_destroy.empty()) {
83 smx_actor_t process = &simix_global->process_to_destroy.front();
84 simix_global->process_to_destroy.pop_front();
85 XBT_DEBUG("Getting rid of %p",process);
86 intrusive_ptr_release(process);
89 xbt_dynar_reset(simix_global->dead_actors_vector);
97 ActorImpl::ActorImpl(simgrid::xbt::string name, simgrid::s4u::Host* host) : name_(name), host_(host), piface_(this)
99 pid_ = simix_process_maxpid++;
100 simcall.issuer = this;
103 ActorImpl::~ActorImpl()
105 delete this->context_;
108 static void dying_daemon(int /*exit_status*/, void* data)
110 std::vector<ActorImpl*>* vect = &simix_global->daemons;
112 auto it = std::find(vect->begin(), vect->end(), static_cast<ActorImpl*>(data));
113 xbt_assert(it != vect->end(), "The dying daemon is not a daemon after all. Please report that bug.");
115 /* Don't move the whole content since we don't really care about the order */
116 std::swap(*it, vect->back());
120 /** This process will be terminated automatically when the last non-daemon process finishes */
121 void ActorImpl::daemonize()
125 simix_global->daemons.push_back(this);
126 SIMIX_process_on_exit(this, dying_daemon, this);
130 simgrid::s4u::Actor* ActorImpl::restart()
132 XBT_DEBUG("Restarting process %s on %s", get_cname(), host_->get_cname());
134 // retrieve the arguments of the old process
135 simgrid::kernel::actor::ProcessArg arg = ProcessArg(host_, this);
137 // kill the old process
138 SIMIX_process_kill(this, (this == simix_global->maestro_process) ? this : SIMIX_process_self());
140 // start the new process
142 SIMIX_process_create(arg.name, std::move(arg.code), arg.data, arg.host, arg.properties.get(), nullptr);
143 simcall_process_set_kill_time(actor, arg.kill_time);
144 actor->set_auto_restart(arg.auto_restart);
146 return actor->ciface();
149 smx_activity_t ActorImpl::suspend(ActorImpl* issuer)
152 XBT_DEBUG("Actor '%s' is already suspended", get_cname());
158 /* If we are suspending another actor that is waiting on a sync, suspend its synchronization. */
159 if (this != issuer) {
161 waiting_synchro->suspend();
162 /* If the other actor is not waiting, its suspension is delayed to when the actor is rescheduled. */
166 return SIMIX_execution_start("suspend", "", 0.0, 1.0, 0.0, this->host_);
170 void ActorImpl::resume()
172 XBT_IN("process = %p", this);
174 if (context_->iwannadie) {
175 XBT_VERB("Ignoring request to suspend an actor that is currently dying.");
183 /* resume the synchronization that was blocking the resumed actor. */
185 waiting_synchro->resume();
190 smx_activity_t ActorImpl::sleep(double duration)
193 throw_exception(std::make_exception_ptr(simgrid::HostFailureException(
194 XBT_THROW_POINT, std::string("Host ") + std::string(host_->get_cname()) + " failed, you cannot sleep there.")));
196 simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl();
197 synchro->host = host_;
198 synchro->surf_sleep = host_->pimpl_cpu->sleep(duration);
199 synchro->surf_sleep->set_data(synchro);
200 XBT_DEBUG("Create sleep synchronization %p", synchro);
205 void ActorImpl::throw_exception(std::exception_ptr e)
212 /* cancel the blocking synchro if any */
213 if (waiting_synchro) {
215 simgrid::kernel::activity::ExecImplPtr exec =
216 boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(waiting_synchro);
217 if (exec != nullptr && exec->surf_action_)
218 exec->surf_action_->cancel();
220 simgrid::kernel::activity::CommImplPtr comm =
221 boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(waiting_synchro);
222 if (comm != nullptr) {
227 simgrid::kernel::activity::SleepImplPtr sleep =
228 boost::dynamic_pointer_cast<simgrid::kernel::activity::SleepImpl>(waiting_synchro);
229 if (sleep != nullptr) {
230 SIMIX_process_sleep_destroy(waiting_synchro);
231 if (std::find(begin(simix_global->process_to_run), end(simix_global->process_to_run), this) ==
232 end(simix_global->process_to_run) &&
233 this != SIMIX_process_self()) {
234 XBT_DEBUG("Inserting %s in the to_run list", get_cname());
235 simix_global->process_to_run.push_back(this);
239 simgrid::kernel::activity::RawImplPtr raw =
240 boost::dynamic_pointer_cast<simgrid::kernel::activity::RawImpl>(waiting_synchro);
241 if (raw != nullptr) {
242 SIMIX_synchro_stop_waiting(this, &simcall);
245 simgrid::kernel::activity::IoImplPtr io =
246 boost::dynamic_pointer_cast<simgrid::kernel::activity::IoImpl>(waiting_synchro);
251 waiting_synchro = nullptr;
254 void create_maestro(simgrid::simix::ActorCode code)
256 /* Create maestro process and initialize it */
257 smx_actor_t maestro = new simgrid::kernel::actor::ActorImpl(simgrid::xbt::string(""), /*host*/ nullptr);
260 maestro->context_ = SIMIX_context_new(simgrid::simix::ActorCode(), nullptr, maestro);
262 maestro->context_ = simix_global->context_factory->create_maestro(code, maestro);
265 maestro->simcall.issuer = maestro;
266 simix_global->maestro_process = maestro;
274 * @brief Internal function to create a process.
276 * This function actually creates the process.
277 * It may be called when a SIMCALL_PROCESS_CREATE simcall occurs,
278 * or directly for SIMIX internal purposes. The sure thing is that it's called from maestro context.
280 * @return the process created
282 smx_actor_t SIMIX_process_create(std::string name, simgrid::simix::ActorCode code, void* data, simgrid::s4u::Host* host,
283 std::unordered_map<std::string, std::string>* properties, smx_actor_t parent_process)
286 XBT_DEBUG("Start actor %s@'%s'", name.c_str(), host->get_cname());
288 if (host->is_off()) {
289 XBT_WARN("Cannot launch process '%s' on failed host '%s'", name.c_str(), host->get_cname());
293 smx_actor_t process = new simgrid::kernel::actor::ActorImpl(simgrid::xbt::string(name), host);
295 xbt_assert(code && host != nullptr, "Invalid parameters");
297 process->set_user_data(data);
298 process->code = code;
300 if (parent_process != nullptr)
301 process->ppid_ = parent_process->pid_;
303 XBT_VERB("Create context %s", process->get_cname());
304 process->context_ = SIMIX_context_new(std::move(code), &SIMIX_process_cleanup, process);
307 if (properties != nullptr)
308 for (auto const& kv : *properties)
309 process->set_property(kv.first, kv.second);
311 /* Add the process to its host's process list */
312 host->pimpl_->process_list_.push_back(*process);
314 XBT_DEBUG("Start context '%s'", process->get_cname());
316 /* Now insert it in the global process list and in the process to run list */
317 simix_global->process_list[process->pid_] = process;
318 XBT_DEBUG("Inserting %s(%s) in the to_run list", process->get_cname(), host->get_cname());
319 simix_global->process_to_run.push_back(process);
320 intrusive_ptr_add_ref(process);
322 /* The on_creation() signal must be delayed until there, where the pid and everything is set */
323 simgrid::s4u::Actor::on_creation(process->iface());
328 smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostname,
329 std::unordered_map<std::string, std::string>* properties, smx_actor_t parent_process)
331 // This is mostly a copy/paste from SIMIX_process_new(),
332 // it'd be nice to share some code between those two functions.
334 sg_host_t host = sg_host_by_name(hostname);
335 XBT_DEBUG("Attach process %s on host '%s'", name, hostname);
337 if (host->is_off()) {
338 XBT_WARN("Cannot launch process '%s' on failed host '%s'", name, hostname);
342 smx_actor_t actor = new simgrid::kernel::actor::ActorImpl(simgrid::xbt::string(name), host);
344 actor->set_user_data(data);
345 actor->code = nullptr;
347 if (parent_process != nullptr)
348 actor->ppid_ = parent_process->pid_;
350 XBT_VERB("Create context %s", actor->get_cname());
351 xbt_assert(simix_global != nullptr, "simix is not initialized, please call MSG_init first");
352 actor->context_ = simix_global->context_factory->attach(&SIMIX_process_cleanup, actor);
355 if (properties != nullptr)
356 for (auto const& kv : *properties)
357 actor->set_property(kv.first, kv.second);
359 /* Add the process to it's host process list */
360 host->pimpl_->process_list_.push_back(*actor);
362 /* Now insert it in the global process list and in the process to run list */
363 simix_global->process_list[actor->pid_] = actor;
364 XBT_DEBUG("Inserting %s(%s) in the to_run list", actor->get_cname(), host->get_cname());
365 simix_global->process_to_run.push_back(actor);
366 intrusive_ptr_add_ref(actor);
368 auto* context = dynamic_cast<simgrid::kernel::context::AttachContext*>(actor->context_);
369 xbt_assert(nullptr != context, "Not a suitable context");
370 context->attach_start();
372 /* The on_creation() signal must be delayed until there, where the pid and everything is set */
373 simgrid::s4u::ActorPtr tmp = actor->iface(); // Passing this directly to on_creation will lead to crashes
374 simgrid::s4u::Actor::on_creation(tmp);
379 void SIMIX_process_detach()
381 auto* context = dynamic_cast<simgrid::kernel::context::AttachContext*>(simgrid::kernel::context::Context::self());
382 if (context == nullptr)
383 xbt_die("Not a suitable context");
385 SIMIX_process_cleanup(context->get_actor());
386 context->attach_stop();
390 * @brief Executes the processes from simix_global->process_to_run.
392 * The processes of simix_global->process_to_run are run (in parallel if
393 * possible). On exit, simix_global->process_to_run is empty, and
394 * simix_global->process_that_ran contains the list of processes that just ran.
395 * The two lists are swapped so, be careful when using them before and after a
396 * call to this function.
398 void SIMIX_process_runall()
400 SIMIX_context_runall();
402 simix_global->process_to_run.swap(simix_global->process_that_ran);
403 simix_global->process_to_run.clear();
407 * @brief Internal function to kill a SIMIX process.
409 * This function may be called when a SIMCALL_PROCESS_KILL simcall occurs,
410 * or directly for SIMIX internal purposes.
412 * @param actor poor victim
413 * @param issuer the actor which has sent the PROCESS_KILL. Important to not schedule twice the same actor.
415 void SIMIX_process_kill(smx_actor_t actor, smx_actor_t issuer)
418 if (actor->finished_) {
419 XBT_DEBUG("Ignoring request to kill process %s@%s that is already dead", actor->get_cname(),
420 actor->host_->get_cname());
424 XBT_DEBUG("Actor '%s'@%s is killing actor '%s'@%s", issuer == nullptr ? "(null)" : issuer->get_cname(),
425 (issuer == nullptr || issuer->host_ == nullptr ? "(null)" : issuer->host_->get_cname()), actor->get_cname(),
426 actor->host_->get_cname());
428 actor->context_->iwannadie = true;
429 actor->blocked_ = false;
430 actor->suspended_ = false;
431 actor->exception = nullptr;
433 // Forcefully kill the actor if its host is turned off. Not an HostFailureException because you should not survive that
434 if (actor->host_->is_off())
435 actor->throw_exception(std::make_exception_ptr(simgrid::kernel::context::StopRequest("host failed")));
437 /* destroy the blocking synchro if any */
438 if (actor->waiting_synchro != nullptr) {
440 simgrid::kernel::activity::ExecImplPtr exec =
441 boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(actor->waiting_synchro);
442 simgrid::kernel::activity::CommImplPtr comm =
443 boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(actor->waiting_synchro);
444 simgrid::kernel::activity::SleepImplPtr sleep =
445 boost::dynamic_pointer_cast<simgrid::kernel::activity::SleepImpl>(actor->waiting_synchro);
446 simgrid::kernel::activity::RawImplPtr raw =
447 boost::dynamic_pointer_cast<simgrid::kernel::activity::RawImpl>(actor->waiting_synchro);
448 simgrid::kernel::activity::IoImplPtr io =
449 boost::dynamic_pointer_cast<simgrid::kernel::activity::IoImpl>(actor->waiting_synchro);
451 if (exec != nullptr) {
452 if (exec->surf_action_) {
453 exec->surf_action_->cancel();
454 exec->surf_action_->unref();
455 exec->surf_action_ = nullptr;
457 } else if (comm != nullptr) {
458 actor->comms.remove(actor->waiting_synchro);
460 // Remove first occurrence of &process->simcall:
461 auto i = boost::range::find(actor->waiting_synchro->simcalls_, &actor->simcall);
462 if (i != actor->waiting_synchro->simcalls_.end())
463 actor->waiting_synchro->simcalls_.remove(&actor->simcall);
464 } else if (sleep != nullptr) {
465 if (sleep->surf_sleep)
466 sleep->surf_sleep->cancel();
468 } else if (raw != nullptr) {
469 SIMIX_synchro_stop_waiting(actor, &actor->simcall);
471 } else if (io != nullptr) {
474 simgrid::kernel::activity::ActivityImplPtr activity = actor->waiting_synchro;
475 xbt_die("Activity %s is of unknown type %s", activity->name_.c_str(),
476 simgrid::xbt::demangle(typeid(activity).name()).get());
479 actor->waiting_synchro = nullptr;
481 if (std::find(begin(simix_global->process_to_run), end(simix_global->process_to_run), actor) ==
482 end(simix_global->process_to_run) &&
484 XBT_DEBUG("Inserting %s in the to_run list", actor->get_cname());
485 simix_global->process_to_run.push_back(actor);
489 /** @deprecated When this function gets removed, also remove the xbt_ex class, that is only there to help users to
491 void SIMIX_process_throw(smx_actor_t actor, xbt_errcat_t cat, int value, const char* msg)
493 SMX_EXCEPTION(actor, cat, value, msg);
495 if (actor->suspended_)
498 /* cancel the blocking synchro if any */
499 if (actor->waiting_synchro) {
501 simgrid::kernel::activity::ExecImplPtr exec =
502 boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(actor->waiting_synchro);
503 if (exec != nullptr && exec->surf_action_)
504 exec->surf_action_->cancel();
506 simgrid::kernel::activity::CommImplPtr comm =
507 boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(actor->waiting_synchro);
508 if (comm != nullptr) {
509 actor->comms.remove(comm);
513 simgrid::kernel::activity::SleepImplPtr sleep =
514 boost::dynamic_pointer_cast<simgrid::kernel::activity::SleepImpl>(actor->waiting_synchro);
515 if (sleep != nullptr) {
516 SIMIX_process_sleep_destroy(actor->waiting_synchro);
517 if (std::find(begin(simix_global->process_to_run), end(simix_global->process_to_run), actor) ==
518 end(simix_global->process_to_run) &&
519 actor != SIMIX_process_self()) {
520 XBT_DEBUG("Inserting %s in the to_run list", actor->get_cname());
521 simix_global->process_to_run.push_back(actor);
525 simgrid::kernel::activity::RawImplPtr raw =
526 boost::dynamic_pointer_cast<simgrid::kernel::activity::RawImpl>(actor->waiting_synchro);
527 if (raw != nullptr) {
528 SIMIX_synchro_stop_waiting(actor, &actor->simcall);
531 simgrid::kernel::activity::IoImplPtr io =
532 boost::dynamic_pointer_cast<simgrid::kernel::activity::IoImpl>(actor->waiting_synchro);
537 actor->waiting_synchro = nullptr;
541 * @brief Kills all running processes.
542 * @param issuer this one will not be killed
544 void SIMIX_process_killall(smx_actor_t issuer)
546 for (auto const& kv : simix_global->process_list)
547 if (kv.second != issuer)
548 SIMIX_process_kill(kv.second, issuer);
551 void SIMIX_process_change_host(smx_actor_t actor, sg_host_t dest)
553 xbt_assert((actor != nullptr), "Invalid parameters");
554 simgrid::xbt::intrusive_erase(actor->host_->pimpl_->process_list_, *actor);
556 dest->pimpl_->process_list_.push_back(*actor);
559 void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t actor)
561 smx_activity_t sync_suspend = actor->suspend(simcall->issuer);
563 if (actor != simcall->issuer) {
564 SIMIX_simcall_answer(simcall);
566 sync_suspend->simcalls_.push_back(simcall);
567 actor->waiting_synchro = sync_suspend;
568 actor->waiting_synchro->suspend();
570 /* If we are suspending ourselves, then just do not finish the simcall now */
573 int SIMIX_process_get_maxpid() {
574 return simix_process_maxpid;
577 int SIMIX_process_count()
579 return simix_global->process_list.size();
582 void* SIMIX_process_self_get_data()
584 smx_actor_t self = SIMIX_process_self();
586 if (self == nullptr) {
589 return self->get_user_data();
592 void SIMIX_process_self_set_data(void *data)
594 SIMIX_process_self()->set_user_data(data);
598 /* needs to be public and without simcall because it is called
599 by exceptions and logging events */
600 const char* SIMIX_process_self_get_name() {
602 smx_actor_t process = SIMIX_process_self();
603 if (process == nullptr || process == simix_global->maestro_process)
606 return process->get_cname();
609 void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t process, double timeout)
611 if (process->finished_) {
612 // The joined process is already finished, just wake up the issuer process right away
613 simcall_process_sleep__set__result(simcall, SIMIX_DONE);
614 SIMIX_simcall_answer(simcall);
617 smx_activity_t sync = SIMIX_process_join(simcall->issuer, process, timeout);
618 sync->simcalls_.push_back(simcall);
619 simcall->issuer->waiting_synchro = sync;
622 smx_activity_t SIMIX_process_join(smx_actor_t issuer, smx_actor_t process, double timeout)
624 smx_activity_t res = issuer->sleep(timeout);
625 intrusive_ptr_add_ref(res.get());
626 SIMIX_process_on_exit(process,
628 auto sleep = static_cast<simgrid::kernel::activity::SleepImpl*>(arg);
629 if (sleep->surf_sleep)
630 sleep->surf_sleep->finish(simgrid::kernel::resource::Action::State::FINISHED);
631 intrusive_ptr_release(sleep);
637 void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration)
639 if (MC_is_active() || MC_record_replay_is_active()) {
640 MC_process_clock_add(simcall->issuer, duration);
641 simcall_process_sleep__set__result(simcall, SIMIX_DONE);
642 SIMIX_simcall_answer(simcall);
645 smx_activity_t sync = simcall->issuer->sleep(duration);
646 sync->simcalls_.push_back(simcall);
647 simcall->issuer->waiting_synchro = sync;
650 void SIMIX_process_sleep_destroy(smx_activity_t synchro)
652 XBT_DEBUG("Destroy sleep synchro %p", synchro.get());
653 simgrid::kernel::activity::SleepImplPtr sleep =
654 boost::dynamic_pointer_cast<simgrid::kernel::activity::SleepImpl>(synchro);
656 if (sleep->surf_sleep) {
657 sleep->surf_sleep->unref();
658 sleep->surf_sleep = nullptr;
663 * @brief Calling this function makes the process to yield.
665 * Only the current process can call this function, giving back the control to maestro.
667 * @param self the current process
669 void SIMIX_process_yield(smx_actor_t self)
671 XBT_DEBUG("Yield actor '%s'", self->get_cname());
673 /* Go into sleep and return control to maestro */
674 self->context_->suspend();
676 /* Ok, maestro returned control to us */
677 XBT_DEBUG("Control returned to me: '%s'", self->get_cname());
679 if (self->context_->iwannadie) {
681 XBT_DEBUG("Process %s@%s is dead", self->get_cname(), self->host_->get_cname());
682 // throw simgrid::kernel::context::StopRequest(); Does not seem to properly kill the actor
683 self->context_->stop();
687 if (self->suspended_) {
688 XBT_DEBUG("Hey! I'm suspended.");
689 xbt_assert(self->exception != nullptr, "Gasp! This exception may be lost by subsequent calls.");
690 self->suspended_ = false;
694 if (self->exception != nullptr) {
695 XBT_DEBUG("Wait, maestro left me an exception");
696 std::exception_ptr exception = std::move(self->exception);
697 self->exception = nullptr;
698 std::rethrow_exception(std::move(exception));
701 if (SMPI_switch_data_segment && not self->finished_) {
702 SMPI_switch_data_segment(self->iface());
706 /** @brief Returns the list of processes to run. */
707 const std::vector<smx_actor_t>& simgrid::simix::process_get_runnable()
709 return simix_global->process_to_run;
712 /** @brief Returns the process from PID. */
713 smx_actor_t SIMIX_process_from_PID(aid_t PID)
715 auto actor = simix_global->process_list.find(PID);
716 return actor == simix_global->process_list.end() ? nullptr : actor->second;
719 void SIMIX_process_on_exit(smx_actor_t actor, int_f_pvoid_pvoid_t fun, void* data)
721 SIMIX_process_on_exit(actor, [fun](int a, void* b) { fun((void*)(intptr_t)a, b); }, data);
724 void SIMIX_process_on_exit(smx_actor_t actor, std::function<void(int, void*)> fun, void* data)
726 xbt_assert(actor, "current process not found: are you in maestro context ?");
728 actor->on_exit.emplace_back(s_smx_process_exit_fun_t{fun, data});
731 /** @brief Restart a process, starting it again from the beginning. */
733 * @ingroup simix_process_management
734 * @brief Creates and runs a new SIMIX process.
736 * The structure and the corresponding thread are created and put in the list of ready processes.
738 * @param name a name for the process. It is for user-level information and can be nullptr.
739 * @param code the main function of the process
740 * @param data a pointer to any data one may want to attach to the new object. It is for user-level information and can
742 * It can be retrieved with the method ActorImpl::getUserData().
743 * @param host where the new agent is executed.
744 * @param properties the properties of the process
746 smx_actor_t simcall_process_create(std::string name, simgrid::simix::ActorCode code, void* data, sg_host_t host,
747 std::unordered_map<std::string, std::string>* properties)
749 smx_actor_t self = SIMIX_process_self();
750 return simgrid::simix::simcall([name, code, data, host, properties, self] {
751 return SIMIX_process_create(name, std::move(code), data, host, properties, self);