CNDP 22.08.0
Loading...
Searching...
No Matches
cne_per_thread.h File Reference

Go to the source code of this file.

Macros

#define CNE_DEFINE_PER_THREAD(type, name)
#define CNE_DECLARE_PER_THREAD(type, name)
#define CNE_PER_THREAD(name)

Detailed Description

Per-thread variables in CNE

This file defines an API for instantiating per-thread "global variables" that are environment-specific. Note that in all environments, a "shared variable" is the default when you use a global variable.

Parts of this are execution environment specific.

Definition in file cne_per_thread.h.

Macro Definition Documentation

◆ CNE_DEFINE_PER_THREAD

#define CNE_DEFINE_PER_THREAD ( type,
name )
Value:
__thread __typeof__(type) per_thread_##name

Macro to define a per thread variable "var" of type "type", don't use keywords like "static" or "volatile" in type, just prefix the whole macro.

Definition at line 30 of file cne_per_thread.h.

◆ CNE_DECLARE_PER_THREAD

#define CNE_DECLARE_PER_THREAD ( type,
name )
Value:
extern __thread __typeof__(type) per_thread_##name

Macro to declare an extern per thread variable "var" of type "type"

Definition at line 35 of file cne_per_thread.h.

◆ CNE_PER_THREAD

#define CNE_PER_THREAD ( name)
Value:
(per_thread_##name)

Read/write the per-thread variable value

Definition at line 40 of file cne_per_thread.h.