summaryrefslogtreecommitdiff
path: root/os/utils.c
diff options
context:
space:
mode:
authorDaniel Drake <drake@endlessm.com>2015-05-12 16:39:22 -0600
committerAdam Jackson <ajax@redhat.com>2015-09-21 10:41:46 -0400
commit94ab7455abc213fc96760e29ab2e943ec682fb22 (patch)
tree439214fad86912d8a9fa23700eafa192e01482aa /os/utils.c
parent58d54ee82dfae5486bc09d04d2760c922d54d631 (diff)
Allow system call restarts upon signal interruption
The X server frequently deals with SIGIO and SIGALRM interruptions. If process execution is inside certain blocking system calls when these signals arrive, e.g. with the kernel blocked on a contended semaphore, the system calls will be interrupted. Some system calls are automatically restartable (the kernel re-executes them with the same parameters once the signal handler returns) but only if the signal handler allows it. Set SA_RESTART on the signal handlers to enable this convenient behaviour. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Daniel Drake <drake@endlessm.com>
Diffstat (limited to 'os/utils.c')
-rw-r--r--os/utils.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/os/utils.c b/os/utils.c
index 868eb043a..9b6fb3081 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1255,6 +1255,7 @@ SmartScheduleInit(void)
memset((char *) &act, 0, sizeof(struct sigaction));
/* Set up the timer signal function */
+ act.sa_flags = SA_RESTART;
act.sa_handler = SmartScheduleTimer;
sigemptyset(&act.sa_mask);
sigaddset(&act.sa_mask, SIGALRM);