]> pd.if.org Git - pdclib/blob - platform/win32/functions/threads/tss_get.c
C11 7.21.6.1p8 "The result of converting a zero value with a precision of zero is...
[pdclib] / platform / win32 / functions / threads / tss_get.c
1 #ifndef REGTEST\r
2 #include <threads.h>\r
3 #include <windows.h>\r
4 \r
5 void *tss_get(tss_t key)\r
6 {\r
7     return TlsGetValue(key->_Key);\r
8 }\r
9 #endif\r
10 \r
11 #ifdef TEST\r
12 #include <_PDCLIB_test.h>\r
13 \r
14 #ifndef REGTEST\r
15 static tss_t key;\r
16 static char v;\r
17 #endif\r
18 \r
19 // Todo: make a thread and test destruction!\r
20 \r
21 int main( void )\r
22 {\r
23 #ifndef REGTEST\r
24     TESTCASE(tss_create(&key, NULL) == thrd_success);\r
25     TESTCASE(tss_get(key) == NULL);\r
26     TESTCASE(tss_set(key, &v) == thrd_success);\r
27     TESTCASE(tss_get(key) == &v);\r
28     tss_delete(key);\r
29 #endif\r
30     return TEST_RESULTS;\r
31 }\r
32 \r
33 #endif