今天看到C语言的线程私有变量,讲的颇有意思,发散下:C语言的线程私有变量(Thread special Data[TSD])类比于Java的Threadlocal.描述,颇有意思。和原来写的,作个比较http://my.oschina.net/u/177808/blog/184348 .net
[root@localhost pthread]# grep pthread_key pthreadtest.e 线程
typedef unsigned int pthread_key_t;blog
extern int pthread_key_create (pthread_key_t *__key,ci
extern int pthread_key_delete (pthread_key_t __key) __attribute__ ((__nothrow__));get
extern void *pthread_getspecific (pthread_key_t __key) __attribute__ ((__nothrow__));class
extern int pthread_setspecific (pthread_key_t __key,thread