From d516ca42d3fcbdc5da9877ab07298f8bb891bff3 Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Thu, 1 Aug 2019 18:14:06 +0200 Subject: vppinfra: Expose function setting __os_thread_index Type: feature This is needed when creating pthreads in client applications, they need a way to set __os_thread_index per thread that does not conflict with the binary API thread index. If __os_thread_index is left to 0 in two client pthreads and they call vl_msg_api_alloc and vec_resize at the same time it can fail due to them sharing (and push/poping) the same clib_per_cpu_mheaps slot. Change-Id: I85d4248a39b641a4d3ad5a1c1bd6e0db5875fab6 Signed-off-by: Nathan Skrzypczak --- src/vppinfra/os.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/vppinfra/os.h') diff --git a/src/vppinfra/os.h b/src/vppinfra/os.h index 3ec214e29b1..50a4ad97c93 100644 --- a/src/vppinfra/os.h +++ b/src/vppinfra/os.h @@ -64,6 +64,12 @@ os_get_thread_index (void) return __os_thread_index; } +static_always_inline void +os_set_thread_index (uword thread_index) +{ + __os_thread_index = thread_index; +} + static_always_inline uword os_get_cpu_number (void) __attribute__ ((deprecated)); -- cgit 1.2.3-korg