summaryrefslogtreecommitdiff
path: root/src/sna/sna_trapezoids_imprecise.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-02-22 08:35:50 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2014-02-22 09:39:35 +0000
commit59d471de7fc7581b112f37a68714d0e1f8728dfd (patch)
tree7d021a04bd71edd6f35a9c94a7dedc51f5411845 /src/sna/sna_trapezoids_imprecise.c
parent1de1104064b5898cbed37e836901694a381c1266 (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_imprecise.c')
-rw-r--r--src/sna/sna_trapezoids_imprecise.c48
1 files changed, 28 insertions, 20 deletions
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;