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_boxes.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/sna/sna_trapezoids_boxes.c') 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); -- cgit v1.2.3