C语言TSD联想到Java的Threadlocal

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

C语言TSD联想到Java的Threadlocal_第1张图片

[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,


你可能感兴趣的:(C语言TSD联想到Java的Threadlocal)