summaryrefslogtreecommitdiff
path: root/src/sna/sna_trapezoids_boxes.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_boxes.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_boxes.c')
-rw-r--r--src/sna/sna_trapezoids_boxes.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/sna/sna_trapezoids_boxes.c b/src/sna/sna_trapezoids_boxes.c
index 6d81da68..d6f0c371 100644
--- a/src/sna/sna_trapezoids_boxes.c
+++ b/src/sna/sna_trapezoids_boxes.c
@@ -1181,19 +1181,23 @@ composite_unaligned_boxes_inplace(struct sna *sna,
dy = (clip.extents.y2 - clip.extents.y1 + num_threads - 1) / num_threads;
num_threads = (clip.extents.y2 - clip.extents.y1 + dy - 1) / dy;
- for (i = 1; i < num_threads; i++) {
- thread[i] = thread[0];
- thread[i].y1 = y;
- thread[i].y2 = y += dy;
- sna_threads_run(rectilinear_inplace_thread, &thread[i]);
- }
+ if (sigtrap_get() == 0) {
+ for (i = 1; i < num_threads; i++) {
+ thread[i] = thread[0];
+ thread[i].y1 = y;
+ thread[i].y2 = y += dy;
+ sna_threads_run(rectilinear_inplace_thread, &thread[i]);
+ }
- assert(y < clip.extents.y2);
- thread[0].y1 = y;
- thread[0].y2 = clip.extents.y2;
- rectilinear_inplace_thread(&thread[0]);
+ assert(y < clip.extents.y2);
+ thread[0].y1 = y;
+ thread[0].y2 = clip.extents.y2;
+ rectilinear_inplace_thread(&thread[0]);
- sna_threads_wait();
+ sna_threads_wait();
+ sigtrap_put();
+ } else
+ sna_threads_kill();
pixman_image_unref(thread[0].dst);
pixman_image_unref(thread[0].src);