X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=platform%2Fwin32%2Ffunctions%2Fthreads%2Ftss_delete.c;fp=platform%2Fwin32%2Ffunctions%2Fthreads%2Ftss_delete.c;h=57a43fd5a30722ee6e53dce6ac3ebe58adf746b9;hp=0000000000000000000000000000000000000000;hb=639bad513ab9399ed9a8c588a476a10dbe6c9478;hpb=008908f7a61acf9df1248c005378a3c4b4393547 diff --git a/platform/win32/functions/threads/tss_delete.c b/platform/win32/functions/threads/tss_delete.c new file mode 100644 index 0000000..57a43fd --- /dev/null +++ b/platform/win32/functions/threads/tss_delete.c @@ -0,0 +1,39 @@ +#ifndef REGTEST +#include +#include +#include + +extern struct _PDCLIB_tss * _PDCLIB_tss_first; +void tss_delete( tss_t key ) +{ + struct _PDCLIB_tss * prev = NULL; + struct _PDCLIB_tss * cur = _PDCLIB_tss_first; + while(cur) { + if(cur == key) { + if(prev) { + prev->_Next = key->_Next; + } else { + _PDCLIB_tss_first = key->_Next; + } + + TlsFree(key->_Key); + free(key); + return; + } + } + + // Not actually a TSS key + abort(); +} +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +/* Tested in tss_get.c */ +int main( void ) +{ + return TEST_RESULTS; +} + +#endif \ No newline at end of file