X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/79f4c4c467150b3bea841b968cabd629e9d9282a..8bfd0f3647c66d4f6c20019475ebb0bfb8018293:/src/msg/msg_legacy.cpp diff --git a/src/msg/msg_legacy.cpp b/src/msg/msg_legacy.cpp index cd258f3cd1..124b077825 100644 --- a/src/msg/msg_legacy.cpp +++ b/src/msg/msg_legacy.cpp @@ -102,7 +102,7 @@ void MSG_process_daemonize(sg_actor_t actor) } void MSG_process_migrate(sg_actor_t actor, sg_host_t host) { - sg_actor_migrate(actor, host); + sg_actor_set_host(actor, host); } void MSG_process_join(sg_actor_t actor, double timeout) { @@ -135,6 +135,30 @@ msg_error_t MSG_process_sleep(double duration) } } +/** @brief Returns the user data of a process. + * + * This function checks whether @a process is a valid pointer and returns the user data associated to this process. + */ +void* MSG_process_get_data(msg_process_t process) +{ + xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!"); + + /* get from SIMIX the MSG process data, and then the user data */ + return sg_actor_data(process); +} + +/** @brief Sets the user data of a process. + * + * This function checks whether @a process is a valid pointer and sets the user data associated to this process. + */ +msg_error_t MSG_process_set_data(msg_process_t process, void* data) +{ + xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!"); + sg_actor_data_set(process, data); + + return MSG_OK; +} + msg_process_t MSG_process_attach(const char* name, void* data, msg_host_t host, xbt_dict_t properties) { return sg_actor_attach(name, data, host, properties); @@ -182,7 +206,11 @@ void MSG_process_unref(msg_process_t process) { sg_actor_unref(process); } - +/** @brief Return the current number MSG processes. */ +int MSG_process_get_number() +{ + return simgrid_get_actor_count(); +} /* ************************** NetZones *************************** */ sg_netzone_t MSG_zone_get_root() { @@ -332,10 +360,6 @@ int MSG_host_is_on(sg_host_t h) { return sg_host_is_on(h); } -int MSG_host_is_off(sg_host_t h) // deprecated -{ - return not sg_host_is_on(h); -} xbt_dict_t MSG_host_get_properties(sg_host_t host) { return sg_host_get_properties(host);