On Fri, Sep 11, 2015 at 7:55 AM, Petri Savolainen <
[email protected]> wrote:

> Maximum thread count is needed for preparation to remove
> ODP_CONFIG_MAX_THREADS. It can be used e.g. to allocate
> resources per thread ID. Thread IDs range from 0 to
> count_max - 1.
>
> Signed-off-by: Petri Savolainen <[email protected]>
> ---
>  include/odp/api/thread.h            | 14 ++++++++++++--
>  platform/linux-generic/odp_thread.c |  5 +++++
>  2 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/include/odp/api/thread.h b/include/odp/api/thread.h
> index 89eae2b..746a830 100644
> --- a/include/odp/api/thread.h
> +++ b/include/odp/api/thread.h
> @@ -54,7 +54,7 @@ typedef enum odp_thread_type_e {
>   * Get thread identifier
>   *
>   * Returns the thread identifier of the current thread. Thread ids range
> from 0
> - * to ODP_CONFIG_MAX_THREADS-1. The ODP thread id is assinged by
> + * to odp_thread_count_max() - 1. The ODP thread id is assinged by
>   * odp_init_local() and freed by odp_term_local(). Thread id is unique
> within
>   * the ODP instance.
>   *
> @@ -68,13 +68,23 @@ int odp_thread_id(void);
>   * Returns the current ODP thread count. This is the number of active
> threads
>   * running the ODP instance. Each odp_init_local() call increments and
> each
>   * odp_term_local() call decrements the count. The count is always
> between 1 and
> - * ODP_CONFIG_MAX_THREADS.
> + * odp_thread_count_max().
>   *
>   * @return Current thread count
>   */
>  int odp_thread_count(void);
>
>  /**
> + * Maximum thread count
> + *
> + * Returns the maximum thread count, which is a constant value and set in
> + * ODP initialization phase.
> + *
> + * @return Maximum thread count
> + */
> +int odp_thread_count_max(void);
>

Should be:
const int odp_thread_count_max(void);

Since these are implementation-defined constants that are being returned.


> +
> +/**
>   * Thread type
>   *
>   * Returns the thread type of the current thread.
> diff --git a/platform/linux-generic/odp_thread.c
> b/platform/linux-generic/odp_thread.c
> index 770c64e..a8ce133 100644
> --- a/platform/linux-generic/odp_thread.c
> +++ b/platform/linux-generic/odp_thread.c
> @@ -204,6 +204,11 @@ int odp_thread_count(void)
>         return thread_globals->num;
>  }
>
> +int odp_thread_count_max(void)
>
const int odp_thread_count_max(void)

> +{
> +       return __ODP_CONFIG_MAX_THREADS;
> +}
> +
>  odp_thread_type_t odp_thread_type(void)
>  {
>         return this_thread->type;
> --
> 2.5.1
>
> _______________________________________________
> lng-odp mailing list
> [email protected]
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to