PSA: Thread-local state is no longer recommended; Common misconceptions about threadid() and nthreads()

That’s a nice discussion to have. There are situations, for instance when the variable to be reduced is a simple immutable, that are nicely handled by the higher level functions.

But I’m not confortable in letting an interface deal with initialization and updating of a shared state that is a mutable, perhaps large, buffer. My issue was always that for these cases the transparency of the explicit threaded loop with a manually created shared state was less prone to confusion than following the syntax indicated by a library.

4 Likes