[PR #679] [MERGED] XWindowsEventQueueBuffer: Fix delays when waiting for new events #1674

Closed
opened 2026-05-05 07:59:14 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/debauchee/barrier/pull/679
Author: @p12tic
Created: 5/20/2020
Status: Merged
Merged: 5/30/2020
Merged by: @shymega

Base: masterHead: x11-fix-event-wait-race-condition


📝 Commits (1)

  • 722b7d6 XWindowsEventQueueBuffer: Fix delays when waiting for new events

📊 Changes

2 files changed (+16 additions, -1 deletions)

View changed files

📝 src/lib/platform/XWindowsEventQueueBuffer.cpp (+14 -1)
📝 src/lib/platform/XWindowsEventQueueBuffer.h (+2 -0)

📄 Description

Fixes #617, #298, #58, https://github.com/symless/synergy-core/issues/6487.

This PR fixes intermittent waits on Linux client. These were caused by the wait loop in XWindowsEventQueueBuffer where we wait for new events. The problem was that we use QLength() to check if there are new events coming from the X11 server. This is insufficient, because it checks only for messages that the XLib already knows about.

Consider the situation when we have no pending events at all and we enter the wait loop. An event arrives in the socket, we are woken up and go on to check QLength(). It will return 0, because the socket itself was not read by XLib. If we call XPending() instead, the socket would be read as we expect, the event would become visible to XLib, XPending() would return nonzero value and we would exit the event loop.

Tested for a couple of days, did not see problems on my local workstation. The fix need further testing, maybe there are other related issues that I have not noticed.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/debauchee/barrier/pull/679 **Author:** [@p12tic](https://github.com/p12tic) **Created:** 5/20/2020 **Status:** ✅ Merged **Merged:** 5/30/2020 **Merged by:** [@shymega](https://github.com/shymega) **Base:** `master` ← **Head:** `x11-fix-event-wait-race-condition` --- ### 📝 Commits (1) - [`722b7d6`](https://github.com/debauchee/barrier/commit/722b7d6cc4117eac900dd0fb51f451f830ce7605) XWindowsEventQueueBuffer: Fix delays when waiting for new events ### 📊 Changes **2 files changed** (+16 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/platform/XWindowsEventQueueBuffer.cpp` (+14 -1) 📝 `src/lib/platform/XWindowsEventQueueBuffer.h` (+2 -0) </details> ### 📄 Description Fixes #617, #298, #58, https://github.com/symless/synergy-core/issues/6487. This PR fixes intermittent waits on Linux client. These were caused by the wait loop in `XWindowsEventQueueBuffer` where we wait for new events. The problem was that we use `QLength()` to check if there are new events coming from the X11 server. This is insufficient, because it checks only for messages that the XLib already knows about. Consider the situation when we have no pending events at all and we enter the wait loop. An event arrives in the socket, we are woken up and go on to check `QLength()`. It will return 0, because the socket itself was not read by XLib. If we call XPending() instead, the socket would be read as we expect, the event would become visible to XLib, XPending() would return nonzero value and we would exit the event loop. Tested for a couple of days, did not see problems on my local workstation. The fix need further testing, maybe there are other related issues that I have not noticed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 07:59:14 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/barrier#1674
No description provided.