A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reduce depth of nested 'if' statements (sonar).
[simgrid.git]
/
src
/
msg
/
msg_comm.cpp
diff --git
a/src/msg/msg_comm.cpp
b/src/msg/msg_comm.cpp
index 8490f780f091d697146a928a3e9a99494e6a2ef0..318d93c48f30b03d117af3802239a447e4afeaf5 100644
(file)
--- a/
src/msg/msg_comm.cpp
+++ b/
src/msg/msg_comm.cpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2004-202
0
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004-202
2
. 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. */
/* 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. */
@@
-84,28
+84,27
@@
int MSG_comm_test(msg_comm_t comm)
*/
int MSG_comm_testany(const_xbt_dynar_t comms)
{
*/
int MSG_comm_testany(const_xbt_dynar_t comms)
{
-
in
t finished_index = -1;
+
ssize_
t finished_index = -1;
/* Create the equivalent array with SIMIX objects: */
/* Create the equivalent array with SIMIX objects: */
- std::vector<simgrid::
kernel::activity::CommImpl*
> s_comms;
+ std::vector<simgrid::
s4u::CommPtr
> s_comms;
s_comms.reserve(xbt_dynar_length(comms));
msg_comm_t comm;
unsigned int cursor;
s_comms.reserve(xbt_dynar_length(comms));
msg_comm_t comm;
unsigned int cursor;
- xbt_dynar_foreach (comms, cursor, comm) {
- s_comms.push_back(static_cast<simgrid::kernel::activity::CommImpl*>(comm->s_comm->get_impl()));
- }
+ xbt_dynar_foreach (comms, cursor, comm)
+ s_comms.push_back(comm->s_comm);
msg_error_t status = MSG_OK;
try {
msg_error_t status = MSG_OK;
try {
- finished_index = sim
call_comm_testany(s_comms.data(), s_comms.size()
);
+ finished_index = sim
grid::s4u::Comm::test_any(s_comms
);
} catch (const simgrid::TimeoutException& e) {
} catch (const simgrid::TimeoutException& e) {
- finished_index = e.
value
;
+ finished_index = e.
get_value()
;
status = MSG_TIMEOUT;
} catch (const simgrid::CancelException& e) {
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) {
status = MSG_TASK_CANCELED;
} catch (const simgrid::NetworkFailureException& e) {
- finished_index = e.
value
;
+ finished_index = e.
get_value()
;
status = MSG_TRANSFER_FAILURE;
}
status = MSG_TRANSFER_FAILURE;
}
@@
-120,7
+119,7
@@
int MSG_comm_testany(const_xbt_dynar_t comms)
}
}
}
}
- return
finished_index
;
+ return
static_cast<int>(finished_index)
;
}
/** @brief Destroys the provided communication. */
}
/** @brief Destroys the provided communication. */
@@
-161,28
+160,28
@@
void MSG_comm_waitall(msg_comm_t* comm, int nb_elem, double timeout)
*/
int MSG_comm_waitany(const_xbt_dynar_t comms)
{
*/
int MSG_comm_waitany(const_xbt_dynar_t comms)
{
-
in
t finished_index = -1;
+
ssize_
t finished_index = -1;
/* Create the equivalent array with SIMIX objects: */
/* Create the equivalent array with SIMIX objects: */
- std::vector<simgrid::
kernel::activity::CommImpl*
> s_comms;
+ std::vector<simgrid::
s4u::CommPtr
> s_comms;
s_comms.reserve(xbt_dynar_length(comms));
msg_comm_t comm;
unsigned int cursor;
xbt_dynar_foreach (comms, cursor, comm) {
s_comms.reserve(xbt_dynar_length(comms));
msg_comm_t comm;
unsigned int cursor;
xbt_dynar_foreach (comms, cursor, comm) {
- s_comms.push_back(
static_cast<simgrid::kernel::activity::CommImpl*>(comm->s_comm->get_impl())
);
+ s_comms.push_back(
comm->s_comm
);
}
msg_error_t status = MSG_OK;
try {
}
msg_error_t status = MSG_OK;
try {
- finished_index = sim
call_comm_waitany(s_comms.data(), s_comms.size()
, -1);
+ finished_index = sim
grid::s4u::Comm::wait_any_for(s_comms
, -1);
} catch (const simgrid::TimeoutException& e) {
} catch (const simgrid::TimeoutException& e) {
- finished_index = e.
value
;
+ finished_index = e.
get_value()
;
status = MSG_TIMEOUT;
} catch (const simgrid::CancelException& e) {
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) {
status = MSG_TASK_CANCELED;
} catch (const simgrid::NetworkFailureException& e) {
- finished_index = e.
value
;
+ finished_index = e.
get_value()
;
status = MSG_TRANSFER_FAILURE;
}
status = MSG_TRANSFER_FAILURE;
}
@@
-197,7
+196,7
@@
int MSG_comm_waitany(const_xbt_dynar_t comms)
(*comm->task_received)->set_not_used();
}
(*comm->task_received)->set_not_used();
}
- return
finished_index
;
+ return
static_cast<int>(finished_index)
;
}
/**
}
/**