bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

windows-tls: implement TLS key destructors for native Windows


From: Bruno Haible
Subject: windows-tls: implement TLS key destructors for native Windows
Date: Wed, 26 Jun 2019 03:41:07 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-151-generic; KDE/5.18.0; x86_64; ; )

Finally got around at implementing support for destructors in the 'tls' and
'tss' modules for native Windows.

I'm also enhancing the unit tests of these modules. These new tests happen to
crash on musl libc (Alpine Linux 3.9); I've reported the bug on the musl libc
list.


2019-06-25  Bruno Haible  <address@hidden>

        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.

2019-06-25  Bruno Haible  <address@hidden>

        tls tests: Add tests for destructors and races.
        * tests/test-tls.c: Include glthread/lock.h.
        (test_tls_dtorcheck1, test_tls_dtorcheck2, test_tls_racecheck): New
        functions.
        (main): Invoke them.
        * modules/tls-tests (Depends-on): Add lock.

2019-06-25  Bruno Haible  <address@hidden>

        tss tests: Add tests for destructors and races.
        * tests/test-tss.c (worker_thread): Fix typo in debug message.
        (test_tss_dtorcheck1, test_tss_dtorcheck2, test_tss_racecheck): New
        functions.
        (main): Invoke them.
        * modules/tls-tests (Depends-on): Add mtx.

Attachment: 0001-windows-tls-Implement-TLS-key-destructors-for-native.patch
Description: Text Data

Attachment: 0002-tls-tests-Add-tests-for-destructors-and-races.patch
Description: Text Data

Attachment: 0003-tss-tests-Add-tests-for-destructors-and-races.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]