All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] signal handlers: volatile sigatomic_t, not volatile OR sigatomic_t
@ 2024-03-20 20:25 Guilherme Janczak
  2024-03-20 20:44 ` Elad Lahav
  2024-03-20 23:02 ` Paul E. McKenney
  0 siblings, 2 replies; 12+ messages in thread
From: Guilherme Janczak @ 2024-03-20 20:25 UTC (permalink / raw)
  To: perfbook

Variables shared with signal handlers must be of type `volatile
sigatomic_t`, not `volatile` or `sigatomic_t` as the current text says,
according to a C11 draft:

    When ... interrupted by ... a signal, values of objects that are
    neither lock-free atomic objects nor of type volatile sig_atomic_t
    are unspecified.

Ref: https://www.iso-9899.info/n1570.html#5.1.2.3p5
Signed-off-by: Guilherme Janczak <guilherme.janczak@yandex.com>
---
 memorder/memorder.tex | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/memorder/memorder.tex b/memorder/memorder.tex
index 5c50d42d..873c3424 100644
--- a/memorder/memorder.tex
+++ b/memorder/memorder.tex
@@ -1317,8 +1317,8 @@ from the viewpoint of the interrupted thread, at least at the
 assembly-language level.
 However, the C and C++ languages do not define the results of handlers
 and interrupted threads sharing plain variables.
-Instead, such shared variables must be \co{sig_atomic_t}, lock-free
-atomics, or \co{volatile}.
+Instead, such shared variables must be \co{volatile sig_atomic_t} or
+lock-free atomics.
 
 On the other hand, because the handler executes within the interrupted
 thread's context, the memory ordering used to synchronize communication
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-03-29  1:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-20 20:25 [PATCH] signal handlers: volatile sigatomic_t, not volatile OR sigatomic_t Guilherme Janczak
2024-03-20 20:44 ` Elad Lahav
2024-03-20 22:26   ` Guilherme Janczak
2024-03-20 23:07     ` Paul E. McKenney
2024-03-28 16:30       ` Elad Lahav
2024-03-29  1:23         ` Akira Yokosawa
     [not found]   ` <r63f5f54bb6cilp542vw52ctpjnjbik5pbfrsswvjzccipokgg@c2kdkpmxbfue>
2024-03-20 23:05     ` Elad Lahav
2024-03-20 23:20       ` Elad Lahav
2024-03-21  0:34         ` Guilherme Janczak
2024-03-21  1:03           ` Elad Lahav
2024-03-21  1:19             ` Elad Lahav
2024-03-20 23:02 ` Paul E. McKenney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.