CNDP  22.08.0
cne_per_thread.h File Reference

Go to the source code of this file.

Macros

#define CNE_DEFINE_PER_THREAD(type, name)   __thread __typeof__(type) per_thread_##name
 
#define CNE_DECLARE_PER_THREAD(type, name)   extern __thread __typeof__(type) per_thread_##name
 
#define CNE_PER_THREAD(name)   (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 
)    __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 
)    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)    (per_thread_##name)

Read/write the per-thread variable value

Definition at line 40 of file cne_per_thread.h.