During testing for oe-core build on QEMU,
SIGALRM can trigger during nanosleep.
This results a different stderr output than expected.
```
==277== Process terminating with default action of signal 14 (SIGALRM)
==277== at 0x36C74C3943: clock_nanosleep@@GLIBC_2.17 (clock_nanosleep.c:43)
==277== by 0x36C74C8726: nanosleep (nanosleep.c:25)
```
This stacktrace printing will not occur
if we add a handler that simply exits.
https://bugs.kde.org/show_bug.cgi?id=435160
Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
size_t nrsw;
} thread_local_t;
+static void sig_alrm_handler(int signo) {
+ _exit(1);
+}
+
static void f(void *data, int n)
{
enum { NR_SWITCHES = 200000 };
pthread_attr_t attr;
int i, res;
+ signal(SIGALRM, sig_alrm_handler);
memset(tlocal, 0, sizeof(tlocal));
pthread_attr_init(&attr);
-Process terminating with default action of signal 14 (SIGALRM)
- at 0x........: swapcontext (in /...libc...)
- by 0x........: f (swapcontext.c:?)
-
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)