1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2021 Mellanox Technologies, Ltd
15 * Simple threads functionality supplied by EAL.
23 * TLS key type, an opaque pointer.
25 typedef struct eal_tls_key *rte_tls_key;
28 * Set core affinity of the current thread.
29 * Support both EAL and non-EAL thread and update TLS.
32 * Pointer to CPU affinity to set.
34 * On success, return 0; otherwise return -1;
36 int rte_thread_set_affinity(rte_cpuset_t *cpusetp);
39 * Get core affinity of the current thread.
42 * Pointer to CPU affinity of current thread.
43 * It presumes input is not NULL, otherwise it causes panic.
46 void rte_thread_get_affinity(rte_cpuset_t *cpusetp);
49 * Create a TLS data key visible to all threads in the process.
50 * the created key is later used to get/set a value.
51 * and optional destructor can be set to be called when a thread exits.
54 * Pointer to store the allocated key.
56 * The function to be called when the thread exits.
57 * Ignored on Windows OS.
61 * On failure, a negative number.
65 int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *));
68 * Delete a TLS data key visible to all threads in the process.
71 * The key allocated by rte_thread_tls_key_create().
75 * On failure, a negative number.
78 int rte_thread_tls_key_delete(rte_tls_key key);
81 * Set value bound to the TLS key on behalf of the calling thread.
84 * The key allocated by rte_thread_tls_key_create().
86 * The value bound to the rte_tls_key key for the calling thread.
90 * On failure, a negative number.
93 int rte_thread_tls_value_set(rte_tls_key key, const void *value);
96 * Get value bound to the TLS key on behalf of the calling thread.
99 * The key allocated by rte_thread_tls_key_create().
102 * On success, value data pointer (can also be NULL).
103 * On failure, NULL and an error number is set in rte_errno.
106 void *rte_thread_tls_value_get(rte_tls_key key);
112 #endif /* _RTE_THREAD_H_ */