summaryrefslogtreecommitdiff
path: root/lib/windows-tls.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-06-20 04:15:30 +0200
committerBruno Haible <bruno@clisp.org>2019-06-20 04:15:30 +0200
commit7435d61f26ef6dece4f94ea00972145b587ef7ab (patch)
tree6d801f856a7e4245071848a33ccdfba955eddaa5 /lib/windows-tls.h
parent7b7305f41af7c79ab3739704febba7cf171b404a (diff)
downloadgnulib-7435d61f26ef6dece4f94ea00972145b587ef7ab.tar.gz
windows-tls: New module.
* lib/windows-tls.h: New file, based on lib/glthread/tls.h. * lib/windows-tls.c: New file, based on lib/glthread/tls.h. * lib/glthread/tls.h: Include windows-tls.h. (gl_tls_key_t): Define using glwthread_tls_key_t. * modules/windows-tls: New file. * modules/tls (Depends-on): Add windows-tls.
Diffstat (limited to 'lib/windows-tls.h')
-rw-r--r--lib/windows-tls.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/windows-tls.h b/lib/windows-tls.h
new file mode 100644
index 0000000000..5e795454e3
--- /dev/null
+++ b/lib/windows-tls.h
@@ -0,0 +1,40 @@
+/* Thread-local storage (native Windows implementation).
+ Copyright (C) 2005-2019 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005. */
+
+#ifndef _WINDOWS_TLS_H
+#define _WINDOWS_TLS_H
+
+#define WIN32_LEAN_AND_MEAN /* avoid including junk */
+#include <windows.h>
+
+typedef DWORD glwthread_tls_key_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int glwthread_tls_key_create (glwthread_tls_key_t *keyp, void (*destructor) (void *));
+extern void *glwthread_tls_get (glwthread_tls_key_t key);
+extern int glwthread_tls_set (glwthread_tls_key_t key, void *value);
+extern int glwthread_tls_key_delete (glwthread_tls_key_t key);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINDOWS_TLS_H */