]> pd.if.org Git - pdclib/blob - platform/win32/functions/threads/tss_get.c
dos2unix
[pdclib] / platform / win32 / functions / threads / tss_get.c
1 #ifndef REGTEST
2 #include <threads.h>
3 #include <windows.h>
4
5 void *tss_get(tss_t key)
6 {
7     return TlsGetValue(key->_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 // Todo: make a thread and test destruction!
20
21 int main( void )
22 {
23 #ifndef REGTEST
24     TESTCASE(tss_create(&key, NULL) == thrd_success);
25     TESTCASE(tss_get(key) == NULL);
26     TESTCASE(tss_set(key, &v) == thrd_success);
27     TESTCASE(tss_get(key) == &v);
28     tss_delete(key);
29 #endif
30     return TEST_RESULTS;
31 }
32
33 #endif