Fixes helgrind complaint found with piglit glx-multithread-clearbuffer.
This is a legit race because override[api].version is cleared before
parsing the override string.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7644>
#include <stdio.h>
#include "context.h"
+#include "util/simple_mtx.h"
+
#include "mtypes.h"
#include "version.h"
#include "git_sha1.h"
+static simple_mtx_t override_lock = _SIMPLE_MTX_INITIALIZER_NP;
+
/**
* Scans 'string' to see if it ends with 'ending'.
*/
STATIC_ASSERT(ARRAY_SIZE(override) == API_OPENGL_LAST + 1);
+ simple_mtx_lock(&override_lock);
+
if (api == API_OPENGLES)
goto exit;
*version = override[api].version;
*fwd_context = override[api].fc_suffix;
*compat_context = override[api].compat_suffix;
+
+ simple_mtx_unlock(&override_lock);
}
/**