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_trapezoids_precise.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_trapezoids_precise.c')
-rw-r--r-- | src/sna/sna_trapezoids_precise.c | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/src/sna/sna_trapezoids_precise.c b/src/sna/sna_trapezoids_precise.c index e5bab16b..bc0a7e7c 100644 --- a/src/sna/sna_trapezoids_precise.c +++ b/src/sna/sna_trapezoids_precise.c @@ -2849,19 +2849,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; @@ -3124,19 +3128,23 @@ precise_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; |