Fix signal handling when io-thread is disabled
PATCH 1/1 Fix signal handling when io-thread is disabled
This fix effectively blocks, in the main thread, the signals handled by signalfd or the compatibility signal thread.
This way, such signals are received synchronously in the main thread through sigfd_handler() instead of triggering the signal handler directly, asynchronously.
--- cpus.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
cpus.c +1 -0
@@ -411,6 +411,7 @@ static int qemu_signal_init(void)sigaddset (&set,SIGIO ); sigaddset(&set, SIGALRM); } +pthread_sigmask (SIG_BLOCK , &set,NULL );#endif sigfd =qemu_signalfd (&set);
Signature · 1 line
1.7.5
Quoted 17 lines · Alexandre Raymond
This fix effectively blocks, in the main thread, the signals handled by signalfd or the compatibility signal thread.
This way, such signals are received synchronously in the main thread through
sigfd_handler()instead of triggering the signal handler directly, asynchronously.Signed-off-by Alexandre Raymond <[email protected]>--- cpus.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)cpus.c +0
-0
cpus.c static int qemu_signal_init(void) · line 417
Quoted 7 lines
cpus.c +1
-0@@ -411,6 +411,7 @@ static int qemu_signal_init(void)sigaddset (&set,SIGIO ); sigaddset(&set, SIGALRM); } +pthread_sigmask (SIG_BLOCK , &set,NULL );#endif sigfd =qemu_signalfd (&set);
Good catch. Probably remained unnoticed as most of us have signalfd support on their boxes so that the window for async delivery was rather small.
But please pull the now common pthread_sigmask out of the #ifdef.
Jan
Hi Jan,
Thanks for reviewing my patch.
Quoted 1 line
But please pull the now common
pthread_sigmaskout of the #ifdef.
Please see v2.
Alexandre