From 59d471de7fc7581b112f37a68714d0e1f8728dfd Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 22 Feb 2014 08:35:50 +0000 Subject: 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 --- src/sna/sna_threads.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/sna/sna_threads.c') 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; -- cgit v1.2.3