glsl: No need to lock in _mesa_glsl_release_types
authorErik Faye-Lund <kusmabite@gmail.com>
Sun, 28 Jun 2015 12:51:07 +0000 (14:51 +0200)
committerMatt Turner <mattst88@gmail.com>
Mon, 29 Jun 2015 16:06:40 +0000 (09:06 -0700)
This function only gets called while mesa is unloading, so there's
no potential of racing or multiple calls at the same time. So let's
just get rid of the locking.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/glsl/glsl_types.cpp

index f675e90cb0d800a331f9dbd971e5cbc972aa6a7a..c6223808bb80ef6507dcbbf2e36c584909fef3b9 100644 (file)
@@ -324,8 +324,10 @@ const glsl_type *glsl_type::get_scalar_type() const
 void
 _mesa_glsl_release_types(void)
 {
-   mtx_lock(&glsl_type::mutex);
-
+   /* Should only be called during atexit (either when unloading shared
+    * object, or if process terminates), so no mutex-locking should be
+    * necessary.
+    */
    if (glsl_type::array_types != NULL) {
       hash_table_dtor(glsl_type::array_types);
       glsl_type::array_types = NULL;
@@ -335,8 +337,6 @@ _mesa_glsl_release_types(void)
       hash_table_dtor(glsl_type::record_types);
       glsl_type::record_types = NULL;
    }
-
-   mtx_unlock(&glsl_type::mutex);
 }