When a thread refers to a global thread_local variable, is it as fast as referring to a normal global variable?
When a thread refers to a function-scoped thread_local variable, is it as fast as referring to a normal function-scoped variable?
Or is there some hidden potentially time-consuming operation such as a hash on the thread ID? If so is there any general standing advice for avoiding multiple such operations, such as caching the address of a thread_scoped variable in a normal function-scoped variable?
Does C _Thread_local differ?
If the answers depend on the underlying threading library, OS, and compiler, I'd like to learn the general terrain of the issue, but my project is using pthreads, gcc 6.x and 9.x, on RedHat and Fedora on x86.
Aucun commentaire:
Enregistrer un commentaire