eal: add generic thread-local-storage functions
authorTal Shnaiderman <talshn@nvidia.com>
Wed, 6 Jan 2021 20:35:53 +0000 (22:35 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 11 Jan 2021 22:28:12 +0000 (23:28 +0100)
commitb1fd151267e6791a7649090c185413293549d033
tree68bbb8325a739d6714533a3cfb312d48d8390a20
parentd136fae5604e8a5e638cc5c9f415a5c636f280c8
eal: add generic thread-local-storage functions

Add support for TLS functionality in EAL.

The following functions are added:
rte_thread_tls_key_create - create a TLS data key.
rte_thread_tls_key_delete - delete a TLS data key.
rte_thread_tls_value_set - set value bound to the TLS key
rte_thread_tls_value_get - get value bound to the TLS key

TLS key is defined by the new type rte_tls_key.

The API allocates the thread local storage (TLS) key.
Any thread of the process can subsequently use this key
to store and retrieve values that are local to the thread.

Those functions are added in addition to TLS capability
in rte_per_lcore.h to allow abstraction of the pthread
layer for all operating systems.

Windows implementation is under librte_eal/windows and
implemented using WIN32 API for Windows only.

Unix implementation is under librte_eal/unix and
implemented using pthread for UNIX compilation.

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
lib/librte_eal/include/rte_thread.h
lib/librte_eal/rte_eal_exports.def
lib/librte_eal/unix/meson.build
lib/librte_eal/unix/rte_thread.c [new file with mode: 0644]
lib/librte_eal/version.map
lib/librte_eal/windows/meson.build
lib/librte_eal/windows/rte_thread.c [new file with mode: 0644]