DPDK  23.07.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 
124 __rte_experimental
125 int
126 rte_thread_create_control(rte_thread_t *thread, const char *name,
127  const rte_thread_attr_t *thread_attr, rte_thread_func thread_func,
128  void *arg);
129 
146 __rte_experimental
147 int rte_thread_join(rte_thread_t thread_id, uint32_t *value_ptr);
148 
163 __rte_experimental
164 int rte_thread_detach(rte_thread_t thread_id);
165 
175 __rte_experimental
177 
194 __rte_experimental
195 void
196 rte_thread_set_name(rte_thread_t thread_id, const char *thread_name);
197 
214 __rte_experimental
216 
232 __rte_experimental
234 
252 __rte_experimental
254  enum rte_thread_priority priority);
255 
256 #ifdef RTE_HAS_CPUSET
257 
275 __rte_experimental
277  rte_cpuset_t *cpuset);
278 
296 __rte_experimental
298  rte_cpuset_t *cpuset);
299 
317 __rte_experimental
319  const rte_cpuset_t *cpuset);
320 
338 __rte_experimental
340  rte_cpuset_t *cpuset);
341 
351 int rte_thread_set_affinity(rte_cpuset_t *cpusetp);
352 
360 void rte_thread_get_affinity(rte_cpuset_t *cpusetp);
361 
362 #endif /* RTE_HAS_CPUSET */
363 
380 __rte_experimental
382  enum rte_thread_priority *priority);
383 
400 __rte_experimental
402  enum rte_thread_priority priority);
403 
422 __rte_experimental
423 int rte_thread_key_create(rte_thread_key *key,
424  void (*destructor)(void *));
425 
438 __rte_experimental
439 int rte_thread_key_delete(rte_thread_key key);
440 
455 __rte_experimental
456 int rte_thread_value_set(rte_thread_key key, const void *value);
457 
470 __rte_experimental
471 void *rte_thread_value_get(rte_thread_key key);
472 
473 #ifdef __cplusplus
474 }
475 #endif
476 
477 #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 int rte_thread_create_control(rte_thread_t *thread, const char *name, const rte_thread_attr_t *thread_attr, rte_thread_func thread_func, void *arg)
__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)
__rte_experimental void rte_thread_set_name(rte_thread_t thread_id, const char *thread_name)
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)