gmain: Fix use of atomic primitives with sig_atomic_t
It seems that `sig_atomic_t` is not the same width as `int` on FreeBSD,
which is causing CI failures:
```
../glib/gmain.c:5206:3: error: '_GStaticAssertCompileTimeAssertion_73' declared as an array with a negative size
g_atomic_int_set (&any_unix_signal_pending, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../glib/gatomic.h:100:5: note: expanded from macro 'g_atomic_int_set'
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gint)); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Fix that by only using `sig_atomic_t` if the code is *not* using atomic
primitives (i.e. in the fallback case). `sig_atomic_t` is only a typedef
around an integer type and is not magic. Its typedef is chosen by the
platform to be async-signal-safe (i.e. read or written in one instruction),
but not necessarily thread-safe.
Signed-off-by:
Philip Withnall <withnall@endlessm.com>
-
Author Maintainer
I accidentally pushed this straight to
master
rather than a feature branch onorigin
. :(@sdroege, would you mind doing a post-hoc review? If there are any issues I can revert this and put it through an MR.
-
mentioned in merge request !1552 (closed)
-
Maintainer
Seems fine to me
-
Author Maintainer
Thanks, sorry for the cock-up.
Please register or sign in to comment