@@ -96,6 +96,32 @@ typedef enum odp_queue_op_mode_t {
} odp_queue_op_mode_t;
+/**
+ * Blocking level
+ *
+ * Blocking level tells how operations behave when one of the threads using
+ * the same resource suspends. A blocking implementation may block other threads
+ * using the same resource for the entire time that one of the threads remain
+ * suspended. On the contrary, a lock-free implementation allows other threads
+ * to make progress while a thread is suspended. Blocking levels are listed from
+ * the weakest to the strongest guarantee of block freedom.
+ *
+ * Performance of non-blocking operations may be lower than blocking ones, but
+ * can be used safely e.g. between threads of real-time and non real-time parts
+ * of an application.
+ */
+typedef enum odp_blocking_level_t {
+ /** Operations may block. Other threads may be blocked while a thread
+ * is suspended. This is the lowest blocking level (no block freedom
+ * guarantees). */
+ ODP_BLOCKING = 0,
+
+ /** Lock-free operation. Other threads can make progress while a thread
+ * is suspended. */
+ ODP_LOCKFREE
+
+} odp_blocking_level_t;
+
/**
* Queue capabilities
*/
@@ -125,6 +151,10 @@ typedef struct odp_queue_capability_t {
* store all available events. */
uint32_t max_size;
+ /** The strongest guarantee of block freedom that is supported
+ * for plain queues. */
+ odp_blocking_level_t blocking_level;
+
} plain;
/** Scheduled queue capabilities */
@@ -138,6 +168,10 @@ typedef struct odp_queue_capability_t {
* store all available events. */
uint32_t max_size;
+ /** The strongest guarantee of block freedom that is supported
+ * for scheduled queues. */
+ odp_blocking_level_t blocking_level;
+
} sched;
} odp_queue_capability_t;
@@ -178,6 +212,13 @@ typedef struct odp_queue_param_t {
* ODP_QUEUE_TYPE_SCHED. */
odp_schedule_param_t sched;
+ /** Blocking level
+ *
+ * Queue implementation must guarantee at least this level of block
+ * freedom for queue enqueue and dequeue/schedule operations.
+ * The default value is ODP_BLOCKING. */
+ odp_blocking_level_t blocking_level;
+
/** Queue context pointer
*
* User defined context pointer associated with the queue. The same