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
the name field of a msg_file_t is actually a full name (including path),
[simgrid.git]
/
examples
/
msg
/
chainsend
/
peer.c
diff --git
a/examples/msg/chainsend/peer.c
b/examples/msg/chainsend/peer.c
index
1827df8
..
9275175
100644
(file)
--- a/
examples/msg/chainsend/peer.c
+++ b/
examples/msg/chainsend/peer.c
@@
-104,17
+104,22
@@
void peer_init(peer_t p, int argc, char *argv[])
void peer_shutdown(peer_t p)
{
void peer_shutdown(peer_t p)
{
- float start_time = MSG_get_clock();
- float end_time = start_time + PEER_SHUTDOWN_DEADLINE;
+ unsigned int size = xbt_dynar_length(p->pending_sends);
+ unsigned int idx;
+ msg_comm_t *comms = xbt_new(msg_comm_t, size);
+
+ for (idx = 0; idx < size; idx++) {
+ comms[idx] = xbt_dynar_get_as(p->pending_sends, idx, msg_comm_t);
+ }
XBT_DEBUG("Waiting for sends to finish before shutdown...");
XBT_DEBUG("Waiting for sends to finish before shutdown...");
- /* MSG_comm_waitall(p->pending_sends, PEER_SHUTDOWN_DEADLINE); FIXME: this doesn't work */
- while (xbt_dynar_length(p->pending_sends) && MSG_get_clock() < end_time) {
- process_pending_connections(p->pending_sends);
- MSG_
process_sleep(1
);
+ MSG_comm_waitall(comms, size, PEER_SHUTDOWN_DEADLINE);
+
+ for (idx = 0; idx < size; idx++) {
+ MSG_
comm_destroy(comms[idx]
);
}
}
- xbt_
assert(xbt_dynar_length(p->pending_sends) == 0, "Shutdown failed, sends still pending after deadline"
);
+ xbt_
free(comms
);
}
void peer_delete(peer_t p)
}
void peer_delete(peer_t p)