Ping. > On 28 Mar 2017, at 10:41, Elo, Matias (Nokia - FI/Espoo) > <matias....@nokia-bell-labs.com> wrote: > > Ping. > >> On 17 Mar 2017, at 14:16, Matias Elo <matias....@nokia.com> wrote: >> >> Signed-off-by: Matias Elo <matias....@nokia.com> >> --- >> platform/linux-generic/Makefile.am | 1 + >> platform/linux-generic/include/odp_thread_internal.h | 20 >> ++++++++++++++++++++ >> platform/linux-generic/odp_thread.c | 10 ++++++++++ >> 3 files changed, 31 insertions(+) >> create mode 100644 platform/linux-generic/include/odp_thread_internal.h >> >> diff --git a/platform/linux-generic/Makefile.am >> b/platform/linux-generic/Makefile.am >> index 056ba67..b2ae971 100644 >> --- a/platform/linux-generic/Makefile.am >> +++ b/platform/linux-generic/Makefile.am >> @@ -144,6 +144,7 @@ noinst_HEADERS = \ >> ${srcdir}/include/odp_schedule_if.h \ >> ${srcdir}/include/odp_sorted_list_internal.h \ >> ${srcdir}/include/odp_shm_internal.h \ >> + ${srcdir}/include/odp_thread_internal.h \ >> ${srcdir}/include/odp_timer_internal.h \ >> ${srcdir}/include/odp_timer_wheel_internal.h \ >> ${srcdir}/include/odp_traffic_mngr_internal.h \ >> diff --git a/platform/linux-generic/include/odp_thread_internal.h >> b/platform/linux-generic/include/odp_thread_internal.h >> new file mode 100644 >> index 0000000..9a8e482 >> --- /dev/null >> +++ b/platform/linux-generic/include/odp_thread_internal.h >> @@ -0,0 +1,20 @@ >> +/* Copyright (c) 2017, Linaro Limited >> + * All rights reserved. >> + * >> + * SPDX-License-Identifier: BSD-3-Clause >> + */ >> + >> +#ifndef ODP_THREAD_INTERNAL_H_ >> +#define ODP_THREAD_INTERNAL_H_ >> + >> +#ifdef __cplusplus >> +extern "C" { >> +#endif >> + >> +pid_t sys_thread_id(void); >> + >> +#ifdef __cplusplus >> +} >> +#endif >> + >> +#endif >> diff --git a/platform/linux-generic/odp_thread.c >> b/platform/linux-generic/odp_thread.c >> index 33a8a7f..e98fa7a 100644 >> --- a/platform/linux-generic/odp_thread.c >> +++ b/platform/linux-generic/odp_thread.c >> @@ -17,15 +17,19 @@ >> #include <odp/api/align.h> >> #include <odp/api/cpu.h> >> #include <odp_schedule_if.h> >> +#include <odp_thread_internal.h> >> >> #include <string.h> >> #include <stdio.h> >> #include <stdlib.h> >> +#include <sys/syscall.h> >> +#include <unistd.h> >> >> typedef struct { >> int thr; >> int cpu; >> odp_thread_type_t type; >> + pid_t sys_thr_id; >> } thread_state_t; >> >> >> @@ -135,6 +139,11 @@ static int free_id(int thr) >> return thread_globals->num; >> } >> >> +pid_t sys_thread_id(void) >> +{ >> + return this_thread->sys_thr_id; >> +} >> + >> int odp_thread_init_local(odp_thread_type_t type) >> { >> int id; >> @@ -159,6 +168,7 @@ int odp_thread_init_local(odp_thread_type_t type) >> thread_globals->thr[id].thr = id; >> thread_globals->thr[id].cpu = cpu; >> thread_globals->thr[id].type = type; >> + thread_globals->thr[id].sys_thr_id = (pid_t)syscall(SYS_gettid); >> >> this_thread = &thread_globals->thr[id]; >> >> -- >> 2.7.4 >> >
Re: [lng-odp] [PATCH v2 1/3] linux-gen: add internal helper for reading system thread id
Elo, Matias (Nokia - FI/Espoo) Thu, 13 Apr 2017 01:23:34 -0700
- [lng-odp] [PATCH v2 1/3] linux-gen: add int... Matias Elo
- [lng-odp] [PATCH v2 3/3] linux-gen: ne... Matias Elo
- [lng-odp] [PATCH v2 2/3] linux-gen: ne... Matias Elo
- Re: [lng-odp] [PATCH v2 1/3] linux-gen... Elo, Matias (Nokia - FI/Espoo)
- Re: [lng-odp] [PATCH v2 1/3] linux... Elo, Matias (Nokia - FI/Espoo)