Android on 32bits arm shipped broken headers that made sigset_t be 32 bits instead of 64.
This means that it's not possible to use signals whose value are >= 32. The default implementation
uses RT signals when available (and they are on Android). But RT signals don't work as expected
as their value is >= 32.
This fix hardcodes some safe signals on Android and add asserts about their values to avoid regressions.
See
5005c6f3fbc1da584c6a550281689cc23f59fe6d for more details.
static int
suspend_signal_get (void)
{
static int
suspend_signal_get (void)
{
+#if defined(PLATFORM_ANDROID)
+ return SIGPWR;
+#elif defined (SIGRTMIN)
static int suspend_signum = -1;
if (suspend_signum == -1)
suspend_signum = mono_threads_suspend_search_alternative_signal ();
static int suspend_signum = -1;
if (suspend_signum == -1)
suspend_signum = mono_threads_suspend_search_alternative_signal ();
static int
restart_signal_get (void)
{
static int
restart_signal_get (void)
{
+#if defined(PLATFORM_ANDROID)
+ return SIGXCPU;
+#elif defined (SIGRTMIN)
static int restart_signum = -1;
if (restart_signum == -1)
restart_signum = mono_threads_suspend_search_alternative_signal ();
static int restart_signum = -1;
if (restart_signum == -1)
restart_signum = mono_threads_suspend_search_alternative_signal ();
/* ensure all the new signals are unblocked */
sigprocmask (SIG_UNBLOCK, &signal_set, NULL);
/* ensure all the new signals are unblocked */
sigprocmask (SIG_UNBLOCK, &signal_set, NULL);
+
+ /*
+ On 32bits arm Android, signals with values >=32 are not usable as their headers ship a broken sigset_t.
+ See 5005c6f3fbc1da584c6a550281689cc23f59fe6d for more details.
+ */
+#ifdef PLATFORM_ANDROID
+ g_assert (suspend_signal_num < 32);
+ g_assert (restart_signal_num < 32);
+ g_assert (abort_signal_num < 32);
+#endif