Blog
Community
Development
Documentation
CNDP
22.08.0
Toggle main menu visibility
Loading...
Searching...
No Matches
cne_thread.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-3-Clause
2
* Copyright (c) 2020-2022 Intel Corporation
3
*/
4
5
#ifndef _CNE_THREAD_H_
6
#define _CNE_THREAD_H_
7
20
// IWYU pragma: no_include "thread_private.h"
21
#include <stdio.h>
// for FILE
22
#include <pthread.h>
23
#include <
cne_common.h
>
// for CNDP_API, CNE_STD_C11
24
#include <stdint.h>
// for uint16_t, uint64_t, uint8_t
25
#include <
uid.h
>
26
27
#ifdef __cplusplus
28
extern
"C"
{
29
#endif
30
31
#define THREAD_WAIT_FOREVER 0
32
#define THREAD_DEFAULT_TIMEOUT 1000
// 1ms timeout
33
#define THREAD_DEFAULT_NAME "Initial-thread"
34
35
typedef
void
*
thd_t
;
36
37
#ifndef _THREAD_PRIVATE_H_
38
/* Define the function prototype if pubicly included */
39
typedef
void (*
thd_func_t
)(
void
*);
40
#endif
41
43
#define DISPLAY_FLAG 0x00
44
#define RX_ONLY_FLAG 0x01
45
#define TX_ONLY_FLAG 0x02
46
#define RXTX_FLAG (RX_ONLY_FLAG | TX_ONLY_FLAG)
47
48
typedef
union
thread_cfg {
49
uint64_t data;
50
void
*arg;
51
52
CNE_STD_C11
53
struct
{
54
uint16_t core;
55
uint16_t pid;
56
uint16_t qid;
57
uint8_t flags;
58
uint8_t pad0;
59
};
60
} thread_cfg_t;
61
65
CNDP_API
int
thread_id
(
void
);
66
75
CNDP_API
thd_t
thread_get
(
int
tidx);
76
89
CNDP_API
int
thread_create
(
const
char
*name,
thd_func_t
func,
void
*arg);
90
102
CNDP_API
int
thread_register
(
const
char
*name, uint64_t pid);
103
112
CNDP_API
int
thread_unregister
(
int
tidx);
113
127
CNDP_API
int
thread_wait
(
int
tid,
unsigned
int
checks,
unsigned
int
usec);
128
142
CNDP_API
int
thread_wait_all
(
unsigned
int
checks,
unsigned
int
usec,
int
skip);
143
152
CNDP_API
int
thread_stop_running
(
int
tidx);
153
162
CNDP_API
int
thread_running
(
int
tidx);
163
174
CNDP_API
int
thread_set_private
(
int
tidx,
void
*priv_);
175
184
CNDP_API
void
*
thread_get_private
(
int
tidx);
185
189
CNDP_API
int
thread_set_affinity
(
int
cpu);
190
199
CNDP_API
const
char
*
thread_name
(
int
tidx);
200
207
CNDP_API
void
thread_dump
(FILE *f);
208
209
#ifdef __cplusplus
210
}
211
#endif
212
213
#endif
/* _CNE_THREAD_H_ */
cne_common.h
CNE_STD_C11
#define CNE_STD_C11
Definition
cne_common.h:91
thread_get
CNDP_API thd_t thread_get(int tidx)
thread_set_private
CNDP_API int thread_set_private(int tidx, void *priv_)
thread_create
CNDP_API int thread_create(const char *name, thd_func_t func, void *arg)
thread_wait_all
CNDP_API int thread_wait_all(unsigned int checks, unsigned int usec, int skip)
thread_running
CNDP_API int thread_running(int tidx)
thread_set_affinity
CNDP_API int thread_set_affinity(int cpu)
thread_unregister
CNDP_API int thread_unregister(int tidx)
thread_name
CNDP_API const char * thread_name(int tidx)
thread_get_private
CNDP_API void * thread_get_private(int tidx)
thread_dump
CNDP_API void thread_dump(FILE *f)
thread_stop_running
CNDP_API int thread_stop_running(int tidx)
thread_wait
CNDP_API int thread_wait(int tid, unsigned int checks, unsigned int usec)
thread_register
CNDP_API int thread_register(const char *name, uint64_t pid)
thd_t
void * thd_t
Definition
cne_thread.h:35
thd_func_t
void(*) thd_func_t(void *)
Definition
cne_thread.h:39
thread_id
CNDP_API int thread_id(void)
uid.h
lib
usr
clib
thread
cne_thread.h
Generated by
1.18.0