llvmpipe: add pipe_thread_wait() calls
authorBrian Paul <brianp@vmware.com>
Fri, 5 Mar 2010 21:24:02 +0000 (14:24 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 5 Mar 2010 21:24:04 +0000 (14:24 -0700)
Wait for threads to exit before cleaning up per-thread data.
Fixes hang on context destruction with glean makeCurrent test.
See fd.o bug 26536.

src/gallium/drivers/llvmpipe/lp_rast.c

index 0f83eea6853f815fb1b3dffcd73287d296f0223d..dd9a8e8856f20dea6cf6770b08cb90dc46ae4e9a 100644 (file)
@@ -846,6 +846,12 @@ void lp_rast_destroy( struct lp_rasterizer *rast )
       pipe_semaphore_signal(&rast->tasks[i].work_ready);
    }
 
+   /* Wait for threads to terminate before cleaning up per-thread data */
+   for (i = 0; i < rast->num_threads; i++) {
+      pipe_thread_wait(rast->threads[i]);
+   }
+
+   /* Clean up per-thread data */
    for (i = 0; i < rast->num_threads; i++) {
       pipe_semaphore_destroy(&rast->tasks[i].work_ready);
       pipe_semaphore_destroy(&rast->tasks[i].work_done);