diff options
author | Bruno Haible <bruno@clisp.org> | 2019-06-26 03:32:46 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2019-06-26 03:32:46 +0200 |
commit | d6bfe479691b16501375442865e328f7b0449279 (patch) | |
tree | 03a5d0604ef7257157f1d2b5deafb45b1919f950 /lib/threads.in.h | |
parent | 14b8ae17a2695e342c8c7af21629abdb0408157a (diff) | |
download | gnulib-d6bfe479691b16501375442865e328f7b0449279.tar.gz |
windows-tls: Implement TLS key destructors for native Windows.
* lib/windows-tls.h (glwthread_tls_process_destructors): New
declaration.
(GLWTHREAD_DESTRUCTOR_ITERATIONS): New macro.
* lib/windows-tls.c: Include <limits.h>, windows-once.h.
(dtor_table_init_once, dtor_table_lock: New variables.
(struct dtor): New type.
(dtor_table, dtors_count, dtors_used, dtors_allocated,
dtor_processing_threads): New variables.
(dtor_table_initialize, dtor_table_ensure_initialized,
dtor_table_shrink_used, glwthread_tls_process_destructors): New
functions.
(glwthread_tls_key_create, glwthread_tls_key_delete): Rewritten to
handle non-NULL destructors.
* modules/windows-tls (Depends-on): Add windows-once.
* lib/glthread/tls.h (glthread_tls_key_init, glthread_tls_key_destroy):
Use the functions declared in windows-tls.h.
* lib/threads.in.h (TSS_DTOR_ITERATIONS): Define using
GLWTHREAD_DESTRUCTOR_ITERATIONS.
* lib/windows-thread.c: Include windows-tls.h.
(wrapper_func, glwthread_thread_exit): Invoke
glwthread_tls_process_destructors.
* modules/windows-thread (Depends-on): Add windows-tls.
Diffstat (limited to 'lib/threads.in.h')
-rw-r--r-- | lib/threads.in.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/threads.in.h b/lib/threads.in.h index b7fed72257..0ed87b3374 100644 --- a/lib/threads.in.h +++ b/lib/threads.in.h @@ -565,7 +565,7 @@ _GL_WARN_ON_USE (cnd_destroy, "cnd_destroy is unportable - " # include "windows-tls.h" typedef glwthread_tls_key_t tss_t; -# define TSS_DTOR_ITERATIONS 0 /* Destructors are currently unsupported. */ +# define TSS_DTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS # else /* Use POSIX threads. */ |