From d0443518bf57fa4111a6437a8f3322f12cd88f29 Mon Sep 17 00:00:00 2001 From: markls Date: Fri, 30 Nov 2007 01:38:14 +0000 Subject: [PATCH] I just realized that the changes I made to the cond-wait test would break programs that contain more than one MPI_Barrier. This should fix the problem for most systems, though maybe this function should do something like SMPI_DO_ONCE and maintain a separate counter for each invocation... git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5097 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/smpi/smpi_base.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index 797e2428ac..d923982079 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -176,7 +176,10 @@ int smpi_mpi_barrier(smpi_mpi_communicator_t comm) { SIMIX_mutex_lock(comm->barrier_mutex); - if (++comm->barrier_count >= comm->size) { + ++comm->barrier_count; + if (comm->barrier_count > comm->size) { // only happens on second barrier... + comm->barrier_count = 0; + } else if (comm->barrier_count == comm->size) { SIMIX_cond_broadcast(comm->barrier_cond); } while (comm->barrier_count < comm->size) { -- 2.20.1