-/* Copyright (c) 2004-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004-2022. 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. */
* @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<simgrid::kernel::activity::CommImpl*> s_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;
}
}
}
- return finished_index;
+ return static_cast<int>(finished_index);
}
/** @brief Destroys the provided communication. */
* @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;
+ ssize_t finished_index = -1;
/* Create the equivalent array with SIMIX objects: */
std::vector<simgrid::kernel::activity::CommImpl*> s_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;
}
(*comm->task_received)->set_not_used();
}
- return finished_index;
+ return static_cast<int>(finished_index);
}
/**