mesa/glthread: correctly compare thread handles
authorEmil Velikov <emil.velikov@collabora.com>
Thu, 20 Apr 2017 15:24:08 +0000 (16:24 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 21 Apr 2017 12:39:57 +0000 (13:39 +0100)
As mentioned in the manual - comparing pthread_t handles via the C
comparison operator is incorrect and pthread_equal() should be used
instead.

Cc: Timothy Arceri <tarceri@itsqueeze.com>
Fixes: d8d81fbc316 ("mesa: Add infrastructure for a worker thread to process GL commands.")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/main/glthread.c

index c4d3f4a434917e0a57a9f83381778bb3627775e2..455b829cd8db7e048465a4a4ae7cd2d41d0e2ca2 100644 (file)
@@ -265,7 +265,7 @@ _mesa_glthread_finish(struct gl_context *ctx)
     * dri interface entrypoints), in which case we don't need to actually
     * synchronize against ourself.
     */
-   if (pthread_self() == glthread->thread)
+   if (pthread_equal(pthread_self(), glthread->thread))
       return;
 
    pthread_mutex_lock(&glthread->mutex);