An example of the same idea but without macros can be seen here: PSA: Thread-local state is no longer recommended; Common misconceptions about threadid() and nthreads() - #26 by Mason
An example of the same idea but without macros can be seen here: PSA: Thread-local state is no longer recommended; Common misconceptions about threadid() and nthreads() - #26 by Mason