On 12/17/2014 06:36 PM, Savolainen, Petri (NSN - FI/Espoo) wrote:
>
>
>> -----Original Message-----
>> From: ext Taras Kondratiuk [mailto:[email protected]]
>> Sent: Wednesday, December 17, 2014 4:49 PM
>> To: [email protected]; Savolainen, Petri (NSN - FI/Espoo)
>> Cc: Taras Kondratiuk
>> Subject: [RFC PATCH] api: init: add a way to determine a last ODP thread
>> termination
>>
>> Signed-off-by: Taras Kondratiuk <[email protected]>
>> ---
>> platform/linux-generic/include/api/odp_init.h | 5 ++---
>> platform/linux-generic/include/odp_internal.h | 1 +
>> platform/linux-generic/odp_init.c | 4 +++-
>> platform/linux-generic/odp_linux.c | 10 ++++++++--
>> platform/linux-generic/odp_thread.c | 14 ++++++++++++--
>> 5 files changed, 26 insertions(+), 8 deletions(-)
>>
>> diff --git a/platform/linux-generic/include/api/odp_init.h
>> b/platform/linux-generic/include/api/odp_init.h
>> index 49f5e41..8ded080 100644
>> --- a/platform/linux-generic/include/api/odp_init.h
>> +++ b/platform/linux-generic/include/api/odp_init.h
>> @@ -124,10 +124,9 @@ int odp_init_local(void);
>> *
>> * @warning The unwinding of HW resources to allow them to be re used
>> without reseting
>> * the device is a complex task that the application is expected to
>> coordinate.
>> - * All threads must call this function before calling
>> - * any other ODP API functions.
>> *
>> - * @retval 0 if successful
>> + * @retval 1 if successful and more ODP thread exists
>> + * @retval 0 if successful and it was the last ODP thread
>
> Document somewhere that the last thread must call odp_term_global().
Ok. Will add.
>
>> * @retval -1 on failure
>> */
>> int odp_term_local(void);
>> diff --git a/platform/linux-generic/include/odp_internal.h
>> b/platform/linux-generic/include/odp_internal.h
>> index ee2ab1a..549d406 100644
>> --- a/platform/linux-generic/include/odp_internal.h
>> +++ b/platform/linux-generic/include/odp_internal.h
>> @@ -23,6 +23,7 @@ int odp_system_info_init(void);
>>
>> int odp_thread_init_global(void);
>> int odp_thread_init_local(void);
>> +int odp_thread_term_local(void);
>>
>> int odp_shm_init_global(void);
>> int odp_shm_init_local(void);
>> diff --git a/platform/linux-generic/odp_init.c b/platform/linux-
>> generic/odp_init.c
>> index c661231..6c2fc8c 100644
>> --- a/platform/linux-generic/odp_init.c
>> +++ b/platform/linux-generic/odp_init.c
>> @@ -90,6 +90,8 @@ int odp_init_local(void)
>>
>> int odp_term_local(void)
>> {
>> - ODP_UNIMPLEMENTED();
>> + if (odp_thread_term_local() == 0)
>
> Should this be odp_thread_term_local() > 0 ? == more threads exist.
Yeah... I've swapped 0 and 1 in the specification at the last moment.
--
Taras Kondratiuk
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp