X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a73d204e173f35c0abb92b26e061929066b8b283..500d56f4d9b6e10ad5bfa2b96e0154f212a3a505:/src/msg/msg_comm.cpp diff --git a/src/msg/msg_comm.cpp b/src/msg/msg_comm.cpp index c386327e38..274358f7d7 100644 --- a/src/msg/msg_comm.cpp +++ b/src/msg/msg_comm.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2004-2019. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2004-2021. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -13,8 +13,6 @@ #include "src/instr/instr_private.hpp" #include "src/msg/msg_private.hpp" -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_comm, msg, "Logging specific to MSG (comm)"); - namespace simgrid { namespace msg { @@ -84,9 +82,9 @@ int MSG_comm_test(msg_comm_t comm) * @return the position of the finished communication if any * (but it may have failed, use MSG_comm_get_status() to know its status), or -1 if none is finished */ -int MSG_comm_testany(xbt_dynar_t comms) +int MSG_comm_testany(const_xbt_dynar_t comms) { - int finished_index = -1; + ssize_t finished_index = -1; /* Create the equivalent array with SIMIX objects: */ std::vector s_comms; @@ -101,13 +99,13 @@ int MSG_comm_testany(xbt_dynar_t comms) try { finished_index = simcall_comm_testany(s_comms.data(), s_comms.size()); } catch (const simgrid::TimeoutException& e) { - finished_index = e.value; + finished_index = e.get_value(); status = MSG_TIMEOUT; } catch (const simgrid::CancelException& e) { - finished_index = e.value; + finished_index = e.get_value(); status = MSG_TASK_CANCELED; } catch (const simgrid::NetworkFailureException& e) { - finished_index = e.value; + finished_index = e.get_value(); status = MSG_TRANSFER_FAILURE; } @@ -122,11 +120,11 @@ int MSG_comm_testany(xbt_dynar_t comms) } } - return finished_index; + return static_cast(finished_index); } /** @brief Destroys the provided communication. */ -void MSG_comm_destroy(msg_comm_t comm) +void MSG_comm_destroy(const_msg_comm_t comm) { delete comm; } @@ -161,7 +159,7 @@ void MSG_comm_waitall(msg_comm_t* comm, int nb_elem, double timeout) * @return the position of the first finished communication * (but it may have failed, use MSG_comm_get_status() to know its status) */ -int MSG_comm_waitany(xbt_dynar_t comms) +int MSG_comm_waitany(const_xbt_dynar_t comms) { int finished_index = -1; @@ -178,13 +176,13 @@ int MSG_comm_waitany(xbt_dynar_t comms) try { finished_index = simcall_comm_waitany(s_comms.data(), s_comms.size(), -1); } catch (const simgrid::TimeoutException& e) { - finished_index = e.value; + finished_index = e.get_value(); status = MSG_TIMEOUT; } catch (const simgrid::CancelException& e) { - finished_index = e.value; + finished_index = e.get_value(); status = MSG_TASK_CANCELED; } catch (const simgrid::NetworkFailureException& e) { - finished_index = e.value; + finished_index = e.get_value(); status = MSG_TRANSFER_FAILURE; } @@ -207,9 +205,8 @@ int MSG_comm_waitany(xbt_dynar_t comms) * @param comm a finished communication * @return the status of the communication, or #MSG_OK if no error occurred during the communication */ -msg_error_t MSG_comm_get_status(msg_comm_t comm) +msg_error_t MSG_comm_get_status(const_msg_comm_t comm) { - return comm->get_status(); } @@ -218,7 +215,7 @@ msg_error_t MSG_comm_get_status(msg_comm_t comm) * @param comm the communication where to get the task * @return the task from the communication */ -msg_task_t MSG_comm_get_task(msg_comm_t comm) +msg_task_t MSG_comm_get_task(const_msg_comm_t comm) { xbt_assert(comm, "Invalid parameter");