X-Git-Url: https://pd.if.org/git/?p=pdclib.old;a=blobdiff_plain;f=opt%2Fpthreads%2Ftss_get.c;fp=opt%2Fpthreads%2Ftss_get.c;h=cff00eab1ce653e9c86b928d0598528cf07bd70a;hp=0000000000000000000000000000000000000000;hb=fd89f130aedf49fbdb3e4f5a24c9cedb56eea22e;hpb=f893788005db800c0bdb8d02ae2a9aa6ce3437a9 diff --git a/opt/pthreads/tss_get.c b/opt/pthreads/tss_get.c new file mode 100644 index 0000000..cff00ea --- /dev/null +++ b/opt/pthreads/tss_get.c @@ -0,0 +1,31 @@ +#ifndef REGTEST +#include +#include + +void *tss_get(tss_t key) +{ + return pthread_getspecific(key); +} +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +#ifndef REGTEST +static tss_t key; +static char v; +#endif + +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