浏览代码

Only queue one wakeup event per wait

Queuing more than one can lead to a spurious wakeup on the next wait.
Cameron Gutman 4 年之前
父节点
当前提交
105de64c2d
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/events/SDL_events.c

+ 3 - 0
src/events/SDL_events.c

@@ -596,6 +596,9 @@ SDL_SendWakeupEvent()
     if (!_this->wakeup_lock || SDL_LockMutex(_this->wakeup_lock) == 0) {
         if (_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) {
             SDL_UnlockMutex(_this->wakeup_lock);