Fir a deadlock when exiting on MacOS (GL backend)
Closes #2159 There was two issues: 1) Fence::wait would return prematurely when the the timeout was set to WAIT_FOREVER. 2) (At least) when running from the command line, events were not read from the main queue. Instead we have to use NSRunLoop instead of NSApplication APIs.
This commit is contained in:
committed by
Mathias Agopian
parent
108dae11e9
commit
4e9cf8ac02
@@ -147,13 +147,7 @@ bool PlatformCocoaGL::pumpEvents() noexcept {
|
||||
if (![NSThread isMainThread]) {
|
||||
return false;
|
||||
}
|
||||
while (true) {
|
||||
NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES];
|
||||
if (event == nil) {
|
||||
break;
|
||||
}
|
||||
[NSApp sendEvent:event];
|
||||
}
|
||||
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate distantPast]];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ FenceStatus FFence::wait(Mode mode, uint64_t timeout) noexcept {
|
||||
}
|
||||
engine.pumpPlatformEvents();
|
||||
const auto elapsed = std::chrono::system_clock::now() - startTime;
|
||||
if (elapsed >= ns(timeout)) {
|
||||
if (timeout != Fence::FENCE_WAIT_FOR_EVER && elapsed >= ns(timeout)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user