B.4 Per-Thread Variables

Figure [*] shows the per-thread-variable API. This API provides the per-thread equivalent of global variables. Although this API is, strictly speaking, not necessary, it can greatly simply coding.

Figure: Per-Thread-Variable API
\begin{figure}{ \scriptsize
\begin{verbatim}DEFINE_PER_THREAD(type, name)
DECL...
...d)
__get_thread_var(name)
init_per_thread(name, v)\end{verbatim}
}\end{figure}

Quick Quiz B.3: How could you work around the lack of a per-thread-variable API on systems that do not provide it? End Quick Quiz



Subsections

Paul E. McKenney 2011-12-16