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_trapezoids_imprecise.c | 48 ++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'src/sna/sna_trapezoids_imprecise.c') diff --git a/src/sna/sna_trapezoids_imprecise.c b/src/sna/sna_trapezoids_imprecise.c index ddf52c2c..93823bb0 100644 --- a/src/sna/sna_trapezoids_imprecise.c +++ b/src/sna/sna_trapezoids_imprecise.c @@ -2851,19 +2851,23 @@ trapezoid_span_inplace__x8r8g8b8(CARD8 op, h = (h + num_threads - 1) / num_threads; num_threads -= (num_threads-1) * h >= region.extents.y2 - region.extents.y1; - for (n = 1; n < num_threads; n++) { - threads[n] = threads[0]; - threads[n].extents.y1 = y; - threads[n].extents.y2 = y += h; + if (sigtrap_get() == 0) { + for (n = 1; n < num_threads; n++) { + threads[n] = threads[0]; + threads[n].extents.y1 = y; + threads[n].extents.y2 = y += h; - sna_threads_run(inplace_x8r8g8b8_thread, &threads[n]); - } + sna_threads_run(inplace_x8r8g8b8_thread, &threads[n]); + } - assert(y < threads[0].extents.y2); - threads[0].extents.y1 = y; - inplace_x8r8g8b8_thread(&threads[0]); + assert(y < threads[0].extents.y2); + threads[0].extents.y1 = y; + inplace_x8r8g8b8_thread(&threads[0]); - sna_threads_wait(); + sna_threads_wait(); + sigtrap_put(); + } else + sna_threads_kill(); /* leaks thread allocations */ } return true; @@ -3125,19 +3129,23 @@ imprecise_trapezoid_span_inplace(struct sna *sna, h = (h + num_threads - 1) / num_threads; num_threads -= (num_threads-1) * h >= region.extents.y2 - region.extents.y1; - for (n = 1; n < num_threads; n++) { - threads[n] = threads[0]; - threads[n].extents.y1 = y; - threads[n].extents.y2 = y += h; + if (sigtrap_get() == 0) { + for (n = 1; n < num_threads; n++) { + threads[n] = threads[0]; + threads[n].extents.y1 = y; + threads[n].extents.y2 = y += h; - sna_threads_run(inplace_thread, &threads[n]); - } + sna_threads_run(inplace_thread, &threads[n]); + } - assert(y < threads[0].extents.y2); - threads[0].extents.y1 = y; - inplace_thread(&threads[0]); + assert(y < threads[0].extents.y2); + threads[0].extents.y1 = y; + inplace_thread(&threads[0]); - sna_threads_wait(); + sna_threads_wait(); + sigtrap_put(); + } else + sna_threads_kill(); /* leaks thread allocations */ } return true; -- cgit v1.2.3