diff mbox

[API-NEXT,02/13] drv: adding barrier.h

Message ID 1471621724-8485-3-git-send-email-christophe.milard@linaro.org
State Superseded
Headers show

Commit Message

Christophe Milard Aug. 19, 2016, 3:48 p.m. UTC
Based on API interface file.

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>

---
 include/odp/drv/spec/barrier.h | 66 ++++++++++++++++++++++++++++++++++++++++++
 platform/Makefile.inc          |  1 +
 2 files changed, 67 insertions(+)
 create mode 100644 include/odp/drv/spec/barrier.h

-- 
2.7.4
diff mbox

Patch

diff --git a/include/odp/drv/spec/barrier.h b/include/odp/drv/spec/barrier.h
new file mode 100644
index 0000000..5ac65a3
--- /dev/null
+++ b/include/odp/drv/spec/barrier.h
@@ -0,0 +1,66 @@ 
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODPDRV execution barriers
+ */
+
+#ifndef ODPDRV_API_BARRIER_H_
+#define ODPDRV_API_BARRIER_H_
+#include <odp/visibility_begin.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @defgroup odpdrv_barrier ODPDRV BARRIER
+ * Thread execution and memory ordering barriers.
+ *
+ * @details
+ * <b> Thread execution barrier (odpdrv_barrier_t) </b>
+ *
+ * Thread execution barrier synchronizes a group of threads to wait on the
+ * barrier until the entire group has reached the barrier.
+ *  @{
+ */
+
+/**
+ * @typedef odpdrv_barrier_t
+ * ODPDRV thread synchronization barrier
+ */
+
+/**
+ * Initialize barrier with thread count.
+ *
+ * @param barr Pointer to a barrier variable
+ * @param count Thread count
+ */
+void odpdrv_barrier_init(odpdrv_barrier_t *barr, int count);
+
+/**
+ * Synchronize thread execution on barrier.
+ * Wait for all threads to arrive at the barrier until they are let loose again.
+ * Threads will block (spin) until the last thread has arrived at the barrier.
+ * All memory operations before the odpdrv_barrier_wait() call will be visible
+ * to all threads when they leave the barrier.
+ *
+ * @param barr Pointer to a barrier variable
+ */
+void odpdrv_barrier_wait(odpdrv_barrier_t *barr);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <odp/visibility_end.h>
+#endif
diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index 079f34d..6ade6df 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -65,6 +65,7 @@  odpdrvspecincludedir= $(includedir)/odp/drv/spec
 odpdrvspecinclude_HEADERS = \
 		  $(top_srcdir)/include/odp/drv/spec/align.h \
 		  $(top_srcdir)/include/odp/drv/spec/atomic.h \
+		  $(top_srcdir)/include/odp/drv/spec/barrier.h \
 		  $(top_srcdir)/include/odp/drv/spec/byteorder.h \
 		  $(top_srcdir)/include/odp/drv/spec/compiler.h \
 		  $(top_srcdir)/include/odp/drv/spec/spinlock.h \