P99

◆ P99_TSS_LOCAL

#define P99_TSS_LOCAL (   NAME)    (*(P99_PASTE3(p00_, NAME, _type)*)p99_tss_get_alloc(&(NAME), sizeof(P99_PASTE3(p00_, NAME, _type))))

Similar to ::p99_tss_get, but also allocates a buffer of p00_size bytes for p00_key.

Under normal circumstances this should always return a valid thread specific buffer, so in some sense this can than be viewed as if this would be refering to a thread specific statically allocated variable.

declare a thread local variable NAME of type T

Remarks
Such a variable must be declared in global scope.
This is implemented with a thread_local variable if the platform supports this. Otherwise this uses p99_tss and P99_TSS_DECLARE_LOCAL etc underneath.
See also
P99_THREAD_LOCAL to access the variable
P99_TSS_DECLARE_LOCAL to see examples how this should work