Port EI fixes to use pipe2 instead of pipe and fcntl (#7470)

* Kill build to prevent multiple processes running in dev

* Port EI fixes to use `pipe2` instead of `pipe` and `fcntl`
This commit is contained in:
Nick Bolton 2024-09-03 20:18:13 +01:00 committed by GitHub
parent cd63a29c19
commit 0eadaec2d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 18 deletions

8
.vscode/launch.json vendored
View file

@ -58,7 +58,7 @@
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/build/bin/synergys", "program": "${workspaceFolder}/build/bin/synergys",
"preLaunchTask": "build" "preLaunchTask": "kill-build"
}, },
{ {
"name": "server windows", "name": "server windows",
@ -67,7 +67,7 @@
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/build/bin/synergys", "program": "${workspaceFolder}/build/bin/synergys",
"internalConsoleOptions": "openOnSessionStart", "internalConsoleOptions": "openOnSessionStart",
"preLaunchTask": "build" "preLaunchTask": "kill-build"
}, },
{ {
"name": "client unix", "name": "client unix",
@ -75,7 +75,7 @@
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/build/bin/synergyc", "program": "${workspaceFolder}/build/bin/synergyc",
"preLaunchTask": "build" "preLaunchTask": "kill-build"
}, },
{ {
"name": "client windows", "name": "client windows",
@ -84,7 +84,7 @@
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/build/bin/synergyc", "program": "${workspaceFolder}/build/bin/synergyc",
"internalConsoleOptions": "openOnSessionStart", "internalConsoleOptions": "openOnSessionStart",
"preLaunchTask": "build" "preLaunchTask": "kill-build"
}, },
{ {
"name": "daemon windows", "name": "daemon windows",

View file

@ -40,15 +40,9 @@ EiEventQueueBuffer::EiEventQueueBuffer(
events_(events) { events_(events) {
// We need a pipe to signal ourselves when addEvent() is called // We need a pipe to signal ourselves when addEvent() is called
int pipefd[2]; int pipefd[2];
int result = pipe(pipefd); int result = pipe2(pipefd, O_NONBLOCK);
assert(result == 0); assert(result == 0);
int pipeflags;
pipeflags = fcntl(pipefd[0], F_GETFL);
fcntl(pipefd[0], F_SETFL, pipeflags | O_NONBLOCK);
pipeflags = fcntl(pipefd[1], F_GETFL);
fcntl(pipefd[1], F_SETFL, pipeflags | O_NONBLOCK);
pipe_r_ = pipefd[0]; pipe_r_ = pipefd[0];
pipe_w_ = pipefd[1]; pipe_w_ = pipefd[1];
} }

View file

@ -51,14 +51,8 @@ XWindowsEventQueueBuffer::XWindowsEventQueueBuffer(
m_userEvent = XInternAtom(m_display, "SYNERGY_USER_EVENT", False); m_userEvent = XInternAtom(m_display, "SYNERGY_USER_EVENT", False);
// set up for pipe hack // set up for pipe hack
int result = pipe(m_pipefd); int result = pipe2(m_pipefd, O_NONBLOCK);
assert(result == 0); assert(result == 0);
int pipeflags;
pipeflags = fcntl(m_pipefd[0], F_GETFL);
fcntl(m_pipefd[0], F_SETFL, pipeflags | O_NONBLOCK);
pipeflags = fcntl(m_pipefd[1], F_GETFL);
fcntl(m_pipefd[1], F_SETFL, pipeflags | O_NONBLOCK);
} }
XWindowsEventQueueBuffer::~XWindowsEventQueueBuffer() { XWindowsEventQueueBuffer::~XWindowsEventQueueBuffer() {