X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=platform%2Fwin32%2Ffunctions%2Fthreads%2Ftss_get.c;fp=platform%2Fwin32%2Ffunctions%2Fthreads%2Ftss_get.c;h=b0a4441a23efe7231ef169cb772eeb756540b942;hb=21c5050f9d173dc1ea751cb8d32549d22d01aba8;hp=0000000000000000000000000000000000000000;hpb=63253d8feb501c19ef09194a6da407a8c331cfad;p=pdclib.old diff --git a/platform/win32/functions/threads/tss_get.c b/platform/win32/functions/threads/tss_get.c new file mode 100644 index 0000000..b0a4441 --- /dev/null +++ b/platform/win32/functions/threads/tss_get.c @@ -0,0 +1,33 @@ +#ifndef REGTEST +#include +#include + +void *tss_get(tss_t key) +{ + return TlsGetValue(key->_Key); +} +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +#ifndef REGTEST +static tss_t key; +static char v; +#endif + +// Todo: make a thread and test destruction! + +int main( void ) +{ +#ifndef REGTEST + TESTCASE(tss_create(&key, NULL) == thrd_success); + TESTCASE(tss_get(key) == NULL); + TESTCASE(tss_set(key, &v) == thrd_success); + TESTCASE(tss_get(key) == &v); + tss_delete(key); +#endif + return TEST_RESULTS; +} + +#endif \ No newline at end of file