`task_local_storage`, why and where?

I recently discovered that there exists such function as task_local_storage for task. It’s exported. Can anyone give me an example of practical application of such functionality?

1 Like

For example, I just used it in DecFP.jl to make the rounding mode thread-safe: Thread safety: per-task state rather than per-thread by stevengj · Pull Request #185 · JuliaMath/DecFP.jl · GitHub

2 Likes

Thanks for both references. Based on them I was able to build an intuition on how task_local_storage can be used.

1 Like