summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/thread/tss_set.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/thread/tss_set.c')
-rw-r--r--libc-top-half/musl/src/thread/tss_set.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/thread/tss_set.c b/libc-top-half/musl/src/thread/tss_set.c
new file mode 100644
index 0000000..70c4fb7
--- /dev/null
+++ b/libc-top-half/musl/src/thread/tss_set.c
@@ -0,0 +1,13 @@
+#include "pthread_impl.h"
+#include <threads.h>
+
+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;
+}