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=639bad513ab9399ed9a8c588a476a10dbe6c9478;hp=0000000000000000000000000000000000000000;hpb=008908f7a61acf9df1248c005378a3c4b4393547;p=pdclib 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