[Top][All Lists]

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

The SIGNAL_SAFE_LIST is not signal-safe

From: Bruno Haible
Subject: The SIGNAL_SAFE_LIST is not signal-safe
Date: Tue, 16 Feb 2021 01:48:00 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-201-generic; KDE/5.18.0; x86_64; ; )

The 'clean-temp' module defines a macro SIGNAL_SAFE_LIST that is supposed to
make the 'linked-list' implementation signal-safe (which implies multithread-
safe, since signal handlers may be executed in arbitrary threads).

My recent reading about lock-free data structures made me suspicious whether
the simple implementation of SIGNAL_SAFE_LIST really is signal-safe. So I
wrote a unit test for it. The result: Out of the three scenarios (1, 2, 3),
two fail. Only the scenario 3 succeeds, meaning that it is signal-safe
only in single-threaded applications.

I'm adding the test. I plan to work on a signal-safe linked list that passes
the test.

2021-02-15  Bruno Haible  <bruno@clisp.org>

        linked-list test: Add test for SIGNAL_SAFE_LIST. (It currently fails.)
        * tests/test-asyncsafe-linked_list.sh: New file.
        * tests/test-asyncsafe-linked_list.c: New file.
        * modules/linked-list-tests (Files): Add them.
        (Depends-on): Add thread, yield, nanosleep, sigaction, sigprocmask.
        (Makefile.am): Arrange to compile test-asyncsafe-linked_list.c and run

Attachment: 0001-linked-list-test-Add-test-for-SIGNAL_SAFE_LIST.-It-c.patch
Description: Text Data

reply via email to

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