Commit 514232c4 by Ben Clayton

VkSemaphore: Unlock/Lock the mutex outside the blocking_call.

marl::blocking_call() calls the passed function on another thread. Attempting to unlock a mutex on a different thread that locked it is illegal. Also lock for destruction. Bug: b/140421726 Change-Id: I87226176bc3a1a454d9c79a139f4d42e51f66814 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43908Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com>
parent b1db156e
......@@ -141,11 +141,11 @@ void Semaphore::wait()
// call, it is assumed that this is negligible
// compared with the actual semaphore wait()
// operation.
marl::blocking_call([ext, &lock]() {
lock.unlock();
lock.unlock();
marl::blocking_call([ext]() {
ext->wait();
lock.lock();
});
lock.lock();
}
// If the import was temporary, reset the semaphore to its previous state.
......@@ -187,6 +187,7 @@ Semaphore::Semaphore(const VkSemaphoreCreateInfo *pCreateInfo, void *mem, const
void Semaphore::destroy(const VkAllocationCallbacks *pAllocator)
{
std::unique_lock<std::mutex> lock(mutex);
while(tempExternal)
{
External *ext = tempExternal;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment