xf86-video-intel: src/sna/sna_threads.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Feb 28 01:03:43 PST 2014


 src/sna/sna_threads.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a3bfb4d3c15e6a37aba5d2f5ba92134c5186e3a4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 28 08:47:21 2014 +0000

    sna: Reorder writes during thread task decoupling
    
    So that the lockless reads do not see the task complete signal prior to
    marking the task as successful. Otherwise, we falsely detect that the
    thread trapped a signal and kill them all.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_threads.c b/src/sna/sna_threads.c
index 089d8ab..52fa405 100644
--- a/src/sna/sna_threads.c
+++ b/src/sna/sna_threads.c
@@ -67,8 +67,8 @@ static void *__run__(void *arg)
 		t->func(t->arg);
 
 		pthread_mutex_lock(&t->mutex);
-		t->func = NULL;
 		t->arg = NULL;
+		t->func = NULL;
 		pthread_cond_signal(&t->cond);
 	}
 	pthread_mutex_unlock(&t->mutex);
@@ -190,8 +190,8 @@ void sna_threads_trap(int sig)
 	ERR(("%s: thread[%d] caught signal %d\n", __func__, n, sig));
 
 	pthread_mutex_lock(&threads[n].mutex);
-	threads[n].func = NULL;
 	threads[n].arg = (void *)(intptr_t)sig;
+	threads[n].func = NULL;
 	pthread_cond_signal(&threads[n].cond);
 	pthread_mutex_unlock(&threads[n].mutex);
 


More information about the xorg-commit mailing list