diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-02-22 08:35:50 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-02-22 09:39:35 +0000 |
commit | 59d471de7fc7581b112f37a68714d0e1f8728dfd (patch) | |
tree | 7d021a04bd71edd6f35a9c94a7dedc51f5411845 /src/sna/sna_threads.c | |
parent | 1de1104064b5898cbed37e836901694a381c1266 (diff) |
sna: Handle asynchronous signals from threads
By killing the threads and leaking their allocations - marginally
preferrable to losing the entire Xserver.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_threads.c')
-rw-r--r-- | src/sna/sna_threads.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/sna/sna_threads.c b/src/sna/sna_threads.c index 6627cbda..8f554965 100644 --- a/src/sna/sna_threads.c +++ b/src/sna/sna_threads.c @@ -205,6 +205,22 @@ void sna_threads_wait(void) } } +void sna_threads_kill(void) +{ + int n; + + ERR(("kill %d threads\n", max_threads)); + assert(max_threads > 0); + + for (n = 0; n < max_threads; n++) + pthread_cancel(threads[n].thread); + + for (n = 0; n < max_threads; n++) + pthread_join(threads[n].thread, NULL); + + max_threads = 0; +} + int sna_use_threads(int width, int height, int threshold) { int num_threads; |