X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/06e1f322dc37862b64749114196f30d1d642fecd..ebe360a9329ebac93cde2d3260b32d0e046ab006:/src/msg/msg_legacy.cpp diff --git a/src/msg/msg_legacy.cpp b/src/msg/msg_legacy.cpp index f39efe177c..a255124bb4 100644 --- a/src/msg/msg_legacy.cpp +++ b/src/msg/msg_legacy.cpp @@ -55,7 +55,9 @@ int MSG_task_listen(const char* alias) /* ************************** Actors *************************** */ void MSG_process_on_exit(int_f_int_pvoid_t fun, void* data) { - sg_actor_on_exit(fun, data); + /* We can't use the sg_actor_on_exit, as the return type of the callback changed: the int in MSG is ignored and was + * removed in sg */ + simgrid::s4u::this_actor::on_exit([fun, data](bool failed) { fun(failed ? 1 /*FAILURE*/ : 0 /*SUCCESS*/, data); }); } int MSG_process_get_PID(const_sg_actor_t actor) @@ -94,7 +96,7 @@ void MSG_process_resume(sg_actor_t actor) { sg_actor_resume(actor); } -int MSG_process_is_suspended(sg_actor_t actor) +int MSG_process_is_suspended(const_sg_actor_t actor) { return sg_actor_is_suspended(actor); } @@ -218,9 +220,9 @@ void MSG_process_unref(const_sg_actor_t process) sg_actor_unref(process); } /** @brief Return the current number MSG processes. */ -int MSG_process_get_number() +int MSG_process_get_number() // XBT_ATTRIB_DEPRECATED_v330 { - return simgrid_get_actor_count(); + return sg_actor_count(); } /* ************************** NetZones *************************** */ sg_netzone_t MSG_zone_get_root() @@ -299,9 +301,17 @@ sg_size_t MSG_storage_write(sg_storage_t storage, sg_size_t size) } /* ************************** hosts *************************** */ -xbt_dynar_t MSG_hosts_as_dynar() +xbt_dynar_t MSG_hosts_as_dynar() // XBT_ATTRIB_DEPRECATED_v330 { - return sg_hosts_as_dynar(); + size_t host_count = sg_host_count(); + sg_host_t* list = sg_host_list(); + + xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t), nullptr); + for (size_t i = 0; i < host_count; i++) + xbt_dynar_push_as(res, sg_host_t, list[i]); + xbt_free(list); + + return res; } size_t MSG_get_host_number() {