From e16f70f45210294321a88f23c85ac45046577adc Mon Sep 17 00:00:00 2001 From: Jens Gustedt Date: Sat, 6 Sep 2014 21:32:53 -0400 Subject: add C11 thread functions operating on tss_t and once_flag These all have POSIX equivalents, but aside from tss_get, they all have minor changes to the signature or return value and thus need to exist as separate functions. --- src/thread/tss_set.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/thread/tss_set.c (limited to 'src/thread/tss_set.c') diff --git a/src/thread/tss_set.c b/src/thread/tss_set.c new file mode 100644 index 00000000..70c4fb72 --- /dev/null +++ b/src/thread/tss_set.c @@ -0,0 +1,13 @@ +#include "pthread_impl.h" +#include + +int tss_set(tss_t k, void *x) +{ + struct pthread *self = __pthread_self(); + /* Avoid unnecessary COW */ + if (self->tsd[k] != x) { + self->tsd[k] = x; + self->tsd_used = 1; + } + return thrd_success; +} -- cgit v1.2.1