1 /* Copyright (c) 2018. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
10 #include <xbt/log.hpp>
12 #include "simgrid/s4u/Barrier.hpp"
13 #include "simgrid/simix.h"
15 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_barrier, "S4U barrier");
20 Barrier::Barrier(unsigned int count) : expected_processes_(count)
22 mutex_ = Mutex::create();
23 cond_ = ConditionVariable::create();
33 XBT_DEBUG("waiting %p %u/%u", this, arrived_processes_, expected_processes_);
34 if (arrived_processes_ == expected_processes_) {
37 arrived_processes_ = 0;
46 } // namespace simgrid