Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Renamed project to chainsend to avoid confusion
[simgrid.git] / examples / msg / chainsend / common.c
1 #include "common.h"
2
3 inline void queue_pending_connection(msg_comm_t comm, xbt_dynar_t q)
4 {
5   xbt_dynar_push(q, &comm);
6 }
7
8 int process_pending_connections(xbt_dynar_t q)
9 {
10   unsigned int iter;
11   int status;
12   int empty = 0;
13   msg_comm_t comm;
14
15   xbt_dynar_foreach(q, iter, comm) {
16     empty = 1;
17     if (MSG_comm_test(comm)) {
18       MSG_comm_destroy(comm);
19       status = MSG_comm_get_status(comm);
20       xbt_assert(status == MSG_OK, __FILE__ ": process_pending_connections() failed");
21       xbt_dynar_cursor_rm(q, &iter);
22       empty = 0;
23     }
24   }
25   return empty;
26 }