Lock protects a critical section in ordered context processing.
Threads enter the section in order. Added dummy typedef for
not breaking the build.

Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com>
---
 include/odp/api/schedule.h                         | 42 ++++++++++++++++++++++
 .../include/odp/plat/schedule_types.h              |  2 ++
 2 files changed, 44 insertions(+)

diff --git a/include/odp/api/schedule.h b/include/odp/api/schedule.h
index 4db8d5b..4c54ec0 100644
--- a/include/odp/api/schedule.h
+++ b/include/odp/api/schedule.h
@@ -31,6 +31,11 @@ extern "C" {
  */
 
 /**
+ * @typedef odp_schedule_olock_t
+ * Scheduler ordered context lock
+ */
+
+/**
  * @def ODP_SCHED_WAIT
  * Wait infinitely
  */
@@ -215,6 +220,43 @@ odp_schedule_group_t odp_schedule_group_create(const char 
*name,
 int odp_schedule_group_destroy(odp_schedule_group_t group);
 
 /**
+ * Initialize ordered context lock
+ *
+ * Initialize an ordered queue context lock. The lock can be accosiated only
+ * with ordered queues and used only within an ordered synchronization context.
+ *
+ * @param queue   Ordered queue
+ * @param lock    Ordered context lock
+ *
+ * @retval 0 on success
+ * @retval <0 on failure
+ */
+int odp_schedule_olock_init(odp_queue_t queue, odp_schedule_olock_t *lock);
+
+/**
+ * Acquire ordered context lock
+ *
+ * This call is valid only when holding an ordered synchronization context. The
+ * lock is used to protect a critical section that is executed within an
+ * ordered context. Threads enter the critical section in the order determined
+ * by the context (source queue). Lock ordering is automatically skipped for
+ * threads that release the context instead of calling the lock.
+ *
+ * @param lock    Ordered context lock
+ */
+void odp_schedule_olock_lock(odp_schedule_olock_t *lock);
+
+/**
+ * Release ordered context lock
+ *
+ * This call is valid only when holding an ordered synchronization context.
+ * Release a previously locked ordered context lock.
+ *
+ * @param lock    Ordered context lock
+ */
+void odp_schedule_olock_unlock(odp_schedule_olock_t *lock);
+
+/**
  * @}
  */
 
diff --git a/platform/linux-generic/include/odp/plat/schedule_types.h 
b/platform/linux-generic/include/odp/plat/schedule_types.h
index bc25c8c..91e62e7 100644
--- a/platform/linux-generic/include/odp/plat/schedule_types.h
+++ b/platform/linux-generic/include/odp/plat/schedule_types.h
@@ -48,6 +48,8 @@ typedef int odp_schedule_group_t;
 
 #define ODP_SCHED_GROUP_NAME_LEN 32
 
+typedef int odp_schedule_olock_t;
+
 /**
  * @}
  */
-- 
2.4.5

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to