Only queue one wakeup event per wait
Queuing more than one can lead to a spurious wakeup on the next wait.main
parent
c262569cd8
commit
105de64c2d
|
@ -596,6 +596,9 @@ SDL_SendWakeupEvent()
|
||||||
if (!_this->wakeup_lock || SDL_LockMutex(_this->wakeup_lock) == 0) {
|
if (!_this->wakeup_lock || SDL_LockMutex(_this->wakeup_lock) == 0) {
|
||||||
if (_this->wakeup_window) {
|
if (_this->wakeup_window) {
|
||||||
_this->SendWakeupEvent(_this, _this->wakeup_window);
|
_this->SendWakeupEvent(_this, _this->wakeup_window);
|
||||||
|
|
||||||
|
/* No more wakeup events needed until we enter a new wait */
|
||||||
|
_this->wakeup_window = NULL;
|
||||||
}
|
}
|
||||||
if (_this->wakeup_lock) {
|
if (_this->wakeup_lock) {
|
||||||
SDL_UnlockMutex(_this->wakeup_lock);
|
SDL_UnlockMutex(_this->wakeup_lock);
|
||||||
|
|
Loading…
Reference in New Issue