C語言TSD聯想到Java的Threadlocal

    今天看到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

相關文章
相關標籤/搜索