Make ManagedStatic registration thread-safe
As part of chromium:944811, LLVM_ENABLE_THREADS was turned off, but
since https://swiftshader-review.googlesource.com/c/SwiftShader/+/33484
we may invoke Reactor JIT-compilation on multiple threads. Instead of
re-enabling LLVM_ENABLE_THREADS wholesale, just make ManagedStatic
thread-safe.
Since sys::Mutex usage is not thread-safe without LLVM_ENABLE_THREADS,
use standard C++ synchronization primitives instead.
Note this change only affects the Subzero JIT backend, not the LLVM JIT.
Bug: chromium:950343
Change-Id: Ie70be4adb2c395459cb9bbd4f6699e0b04969c74
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/45328
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by:
Nicolas Capens <nicolascapens@google.com>
Reviewed-by:
Alexis Hétu <sugoi@google.com>
Reviewed-by:
Antonio Maiorano <amaiorano@google.com>
Showing
Please
register
or
sign in
to comment