C语言TSD联想到Java的Threadlocal

原创
2014/08/05 23:18
阅读数 117

    今天看到C语言的线程私有变量,讲的很有意思,发散下:C语言的线程私有变量(Thread special Data[TSD])类比于Java的Threadlocal.描述,很有意思。和原来写的,做个比较http://my.oschina.net/u/177808/blog/184348

[root@localhost pthread]# grep pthread_key pthreadtest.e 

typedef unsigned int pthread_key_t;

extern int pthread_key_create (pthread_key_t *__key,

extern int pthread_key_delete (pthread_key_t __key) __attribute__ ((__nothrow__));

extern void *pthread_getspecific (pthread_key_t __key) __attribute__ ((__nothrow__));

extern int pthread_setspecific (pthread_key_t __key,


展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部