DPDK  22.11.0
rte_thread.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2021 Mellanox Technologies, Ltd
3  * Copyright (C) 2022 Microsoft Corporation
4  */
5 
6 #include <stdint.h>
7 
8 #include <rte_os.h>
9 #include <rte_compat.h>
10 
11 #ifndef _RTE_THREAD_H_
12 #define _RTE_THREAD_H_
13 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
29 typedef struct {
30  uintptr_t opaque_id;
31 } rte_thread_t;
32 
43 typedef uint32_t (*rte_thread_func) (void *arg);
44 
53 };
54 
58 typedef struct {
59  enum rte_thread_priority priority;
60 #ifdef RTE_HAS_CPUSET
61  rte_cpuset_t cpuset;
62 #endif
64 
68 typedef struct eal_tls_key *rte_thread_key;
69 
92 __rte_experimental
93 int rte_thread_create(rte_thread_t *thread_id,
94  const rte_thread_attr_t *thread_attr,
95  rte_thread_func thread_func, void *arg);
96 
113 __rte_experimental
114 int rte_thread_join(rte_thread_t thread_id, uint32_t *value_ptr);
115 
130 __rte_experimental
131 int rte_thread_detach(rte_thread_t thread_id);
132 
142 __rte_experimental
144 
161 __rte_experimental
163 
179 __rte_experimental
181 
199 __rte_experimental
201  enum rte_thread_priority priority);
202 
203 #ifdef RTE_HAS_CPUSET
204 
222 __rte_experimental
224  rte_cpuset_t *cpuset);
225 
243 __rte_experimental
245  rte_cpuset_t *cpuset);
246 
264 __rte_experimental
266  const rte_cpuset_t *cpuset);
267 
285 __rte_experimental
287  rte_cpuset_t *cpuset);
288 
298 int rte_thread_set_affinity(rte_cpuset_t *cpusetp);
299 
308 void rte_thread_get_affinity(rte_cpuset_t *cpusetp);
309 
310 #endif /* RTE_HAS_CPUSET */
311 
328 __rte_experimental
330  enum rte_thread_priority *priority);
331 
348 __rte_experimental
350  enum rte_thread_priority priority);
351 
370 __rte_experimental
371 int rte_thread_key_create(rte_thread_key *key,
372  void (*destructor)(void *));
373 
386 __rte_experimental
387 int rte_thread_key_delete(rte_thread_key key);
388 
403 __rte_experimental
404 int rte_thread_value_set(rte_thread_key key, const void *value);
405 
418 __rte_experimental
419 void *rte_thread_value_get(rte_thread_key key);
420 
421 #ifdef __cplusplus
422 }
423 #endif
424 
425 #endif /* _RTE_THREAD_H_ */
__rte_experimental int rte_thread_attr_init(rte_thread_attr_t *attr)
__rte_experimental int rte_thread_attr_get_affinity(rte_thread_attr_t *thread_attr, rte_cpuset_t *cpuset)
__rte_experimental int rte_thread_set_priority(rte_thread_t thread_id, enum rte_thread_priority priority)
__rte_experimental int rte_thread_join(rte_thread_t thread_id, uint32_t *value_ptr)
__rte_experimental int rte_thread_set_affinity_by_id(rte_thread_t thread_id, const rte_cpuset_t *cpuset)
__rte_experimental int rte_thread_equal(rte_thread_t t1, rte_thread_t t2)
__rte_experimental int rte_thread_key_delete(rte_thread_key key)
__rte_experimental void * rte_thread_value_get(rte_thread_key key)
struct eal_tls_key * rte_thread_key
Definition: rte_thread.h:68
rte_thread_priority
Definition: rte_thread.h:48
rte_cpuset_t cpuset
Definition: rte_thread.h:61
__rte_experimental int rte_thread_detach(rte_thread_t thread_id)
uintptr_t opaque_id
Definition: rte_thread.h:30
__rte_experimental rte_thread_t rte_thread_self(void)
int rte_thread_set_affinity(rte_cpuset_t *cpusetp)
void rte_thread_get_affinity(rte_cpuset_t *cpusetp)
__rte_experimental int rte_thread_key_create(rte_thread_key *key, void(*destructor)(void *))
__rte_experimental int rte_thread_get_priority(rte_thread_t thread_id, enum rte_thread_priority *priority)
__rte_experimental int rte_thread_attr_set_priority(rte_thread_attr_t *thread_attr, enum rte_thread_priority priority)
uint32_t(* rte_thread_func)(void *arg)
Definition: rte_thread.h:43
__rte_experimental int rte_thread_value_set(rte_thread_key key, const void *value)
__rte_experimental int rte_thread_get_affinity_by_id(rte_thread_t thread_id, rte_cpuset_t *cpuset)
__rte_experimental int rte_thread_attr_set_affinity(rte_thread_attr_t *thread_attr, rte_cpuset_t *cpuset)
__rte_experimental int rte_thread_create(rte_thread_t *thread_id, const rte_thread_attr_t *thread_attr, rte_thread_func thread_func, void *arg)