Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge the content of xbt/exception.hpp into simgrid/Exception.hpp
[simgrid.git] / src / s4u / s4u_Barrier.cpp
index cd11176..d19fb26 100644 (file)
@@ -6,11 +6,11 @@
 #include <exception>
 #include <mutex>
 
-#include <xbt/ex.hpp>
-#include <xbt/log.hpp>
-
+#include "simgrid/Exception.hpp"
+#include "simgrid/barrier.h"
 #include "simgrid/s4u/Barrier.hpp"
 #include "simgrid/simix.h"
+#include "xbt/log.hpp"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_barrier, "S4U barrier");
 
@@ -42,3 +42,22 @@ int Barrier::wait()
 }
 } // namespace s4u
 } // namespace simgrid
+
+/* **************************** Public C interface *************************** */
+
+sg_bar_t sg_barrier_init(unsigned int count)
+{
+  return new simgrid::s4u::Barrier(count);
+}
+
+/** @brief Initializes a barrier, with count elements */
+void sg_barrier_destroy(sg_bar_t bar)
+{
+  delete bar;
+}
+
+/** @brief Performs a barrier already initialized */
+int sg_barrier_wait(sg_bar_t bar)
+{
+  return bar->wait();
+}