B.4 Per-Thread Variables
Keywords: perfbook_html

#
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

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

- B.4.1 DEFINE_PER_THREAD()
- B.4.2 DECLARE_PER_THREAD()
- B.4.3 per_thread()
- B.4.4 __get_thread_var()
- B.4.5 init_per_thread()
- B.4.6 Usage Example