]> pd.if.org Git - pdclib.old/blob - opt/pthreads/tss_get.c
fwrite: output line buffered content as we go along
[pdclib.old] / opt / pthreads / tss_get.c
1 #ifndef REGTEST
2 #include <threads.h>
3 #include <pthread.h>
4
5 void *tss_get(tss_t key)
6 {
7     return pthread_getspecific(key);
8 }
9 #endif
10
11 #ifdef TEST
12 #include <_PDCLIB_test.h>
13
14 #ifndef REGTEST
15 static tss_t key;
16 static char v;
17 #endif
18
19 int main( void )
20 {
21 #ifndef REGTEST
22     TESTCASE(tss_create(&key, NULL) == thrd_success);
23     TESTCASE(tss_get(key) == NULL);
24     TESTCASE(tss_set(key, &v) == thrd_success);
25     TESTCASE(tss_get(key) == &v);
26     tss_delete(key);
27 #endif
28     return TEST_RESULTS;
29 }
30
31 #endif