It is cleaner and, with SG 3.5, it makes a deadlock vanish.
-./loba cluster1000.xml -N64 -L100 -i100 -a fair -T hcube
-=> leads to deadlock (with stable)
-
#include "misc.h"
#include "options.h"
#include "misc.h"
#include "options.h"
+#include "simgrid_features.h"
#include "tracing.h"
#include "communicator.h"
#include "tracing.h"
#include "communicator.h"
void communicator::flush(bool wait)
{
void communicator::flush(bool wait)
{
- using std::tr1::bind;
- using std::tr1::placeholders::_1;
-
sent_comm.remove_if(comm_test_n_destroy);
if (wait && !sent_comm.empty()) {
sent_comm.remove_if(comm_test_n_destroy);
if (wait && !sent_comm.empty()) {
- xbt_dynar_t comms = xbt_dynar_new(sizeof(msg_comm_t), NULL);
- while (!sent_comm.empty()) {
- std::for_each(sent_comm.begin(), sent_comm.end(),
- bind(xbt_dynar_push,
- comms, bind(misc::address<msg_comm_t>(), _1)));
- MSG_comm_waitany(comms);
- xbt_dynar_reset(comms);
- sent_comm.remove_if(comm_test_n_destroy);
- }
- xbt_dynar_free(&comms);
+ msg_comm_t comms[sent_comm.size()];
+ std::copy(sent_comm.begin(), sent_comm.end(), comms);
+ MSG_comm_waitall(comms, sent_comm.size(), -1.0);
+ if (!MSG_WAIT_DESTROYS_COMMS)
+ std::for_each(sent_comm.begin(), sent_comm.end(), MSG_comm_destroy);
+ sent_comm.clear();
std::for_each(neigh.begin(), neigh.end(),
bind(&process::finalize1, this, _1));
std::for_each(neigh.begin(), neigh.end(),
bind(&process::finalize1, this, _1));
- DEBUG2("wait for CLOSE from %lu neighbor%s",
- (unsigned long )neigh.size(), ESSE(neigh.size()));
while (may_receive()) {
comm.flush(false);
while (may_receive()) {
comm.flush(false);
+ DEBUG2("waiting for %d CTRL and %d DATA CLOSE",
+ ctrl_close_pending, data_close_pending);