用C _Thread_local存储类说明? [英] _Thread_local storage class specifier in C?

查看:270
本文介绍了用C _Thread_local存储类说明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在书上看到一张纸条Ç如何编程的一些新标准7 名为C存储类 _Thread_local

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

新的C标准增加了存储类说明 _Thread_local ,其中
  超出了本书的范围。

The new C standard adds storage class specifier _Thread_local, which is beyond this book's scope.

我看着它在谷歌和这里,但没有显示出来。可能有人请我提供一些链接呢?

I looked for it in Google and here but nothing show up. Could someone please provide me some link about it?

推荐答案

标记 _Thread_local 变量给出线程的存储时间 - 也就是说,他们被分配时一个线程开始,并且当线头释放。这样的变量是本地的线程,因为每个线程都有自己的变量副本。这是相对于静态存储持续时间(对于整个程序中的变量的一个实例)。请参见 HTTP://en.cp$p$pference.com/w/ C /语言/ storage_class_specifiers ,获取更多详情。

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.

这篇关于用C _Thread_local存储类说明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆