diff mbox

[API-NEXT,2/5] api: queue: add odp_queue_lock_count() API

Message ID 1441507824-16437-3-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Sept. 6, 2015, 2:50 a.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 include/odp/api/queue.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Savolainen, Petri (Nokia - FI/Espoo) Sept. 10, 2015, 1:50 p.m. UTC | #1
> -----Original Message-----

> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of

> ext Bill Fischofer

> Sent: Sunday, September 06, 2015 5:50 AM

> To: lng-odp@lists.linaro.org

> Subject: [lng-odp] [API-NEXT PATCH 2/5] api: queue: add

> odp_queue_lock_count() API

> 

> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

> ---

>  include/odp/api/queue.h | 12 ++++++++++++

>  1 file changed, 12 insertions(+)

> 

> diff --git a/include/odp/api/queue.h b/include/odp/api/queue.h

> index ce04eb4..56afcbf 100644

> --- a/include/odp/api/queue.h

> +++ b/include/odp/api/queue.h

> @@ -245,6 +245,18 @@ odp_schedule_prio_t

> odp_queue_sched_prio(odp_queue_t queue);

>  odp_schedule_group_t odp_queue_sched_group(odp_queue_t queue);

> 

>  /**

> + * Queue lock count

> + *

> + * @note Passing an invalid queue_handle will result in UNDEFINED

> behavior


The note can be removed, since it's true for all ODP API calls. Instead body of the documentation could say e.g.

Return number of ordered locks associated with this ordered queue. Lock count is defined in odp_schedule_param_t.

> + *

> + * @param queue   Queue handle

> + *

> + * @return Number of ordered locks associated with this ordered queue

> + * @retval 0 Queue is not ordered or was not created with ordered


The return type could be 'int' and return <0 on failure. User can still compare count > 0, to see if there are any locks.

Count will be a small number anyway and <0 is more flexible for error reporting than uint.

-Petri


> locks

> + */

> +uint32_t odp_queue_lock_count(odp_queue_t queue);

> +

> +/**

>   * Get printable value for an odp_queue_t

>   *

>   * @param hdl  odp_queue_t handle to be printed

> --

> 2.1.4

> 

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/include/odp/api/queue.h b/include/odp/api/queue.h
index ce04eb4..56afcbf 100644
--- a/include/odp/api/queue.h
+++ b/include/odp/api/queue.h
@@ -245,6 +245,18 @@  odp_schedule_prio_t odp_queue_sched_prio(odp_queue_t queue);
 odp_schedule_group_t odp_queue_sched_group(odp_queue_t queue);
 
 /**
+ * Queue lock count
+ *
+ * @note Passing an invalid queue_handle will result in UNDEFINED behavior
+ *
+ * @param queue   Queue handle
+ *
+ * @return Number of ordered locks associated with this ordered queue
+ * @retval 0 Queue is not ordered or was not created with ordered locks
+ */
+uint32_t odp_queue_lock_count(odp_queue_t queue);
+
+/**
  * Get printable value for an odp_queue_t
  *
  * @param hdl  odp_queue_t handle to be printed