Fix a race condition when tearing down FrameInfo (#9413)
* HandleAllocator::deallocate() was unsafe It needs to know the concrete type to call the proper destructor, so if it was given a base type handle (e.g. Handle<HwFoo>) it would not destroy it properly. * add AsyncJobQueue::cancelAll() * Fix a race condition when tearing down FrameInfo It is actually invalid to destroy a Handle<HwFence> while inside fenceWait(). Updated the HwFence implementations so that they don't pretend they can handle being destroyed during fenceWait(), they can't. FrameInfo now cancels all the pending callbacks and waits for the currently executing one to terminate, *before* destroying the handles. Reenable the gpuFrameComplete metric, as it should be working now.
This commit is contained in:
@@ -60,6 +60,13 @@ AsyncJobQueue::~AsyncJobQueue() noexcept {
|
||||
#endif
|
||||
}
|
||||
|
||||
void AsyncJobQueue::cancelAll() noexcept {
|
||||
#if !defined(__EMSCRIPTEN__)
|
||||
std::unique_lock const lock(mLock);
|
||||
mQueue.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
void AsyncJobQueue::push(Job&& job) {
|
||||
#if !defined(__EMSCRIPTEN__)
|
||||
std::unique_lock lock(mLock);
|
||||
|
||||
Reference in New Issue
Block a user