_Thread_local storage class specifier in C?

后端 未结 1 1802
余生分开走
余生分开走 2021-01-13 17:25

I read a note in the book C How to Program 7th about some new standard C storage class named _Thread_local:

The new C standard adds stora

相关标签:
1条回答
  • 2021-01-13 18:00

    Variables marked with _Thread_local are given "thread" storage duration -- that is, they are allocated when a thread begins, and deallocated when the thread ends. Such variables are "local" to the thread, since every thread has its own copy of the variable. This is in contrast to static storage duration (one instance of the variable for the entire program). See http://en.cppreference.com/w/c/language/storage_class_specifiers for more details.

    0 讨论(0)
提交回复
热议问题