Use self-pipe instead of signal-blocking for SIGCHLD/SIGWINCH#69
Use self-pipe instead of signal-blocking for SIGCHLD/SIGWINCH#69rianhunter wants to merge 1 commit into
Conversation
eacb581 to
91137e5
Compare
| int flags = fcntl(fd, F_GETFL, 0); | ||
| if (flags < 0) return false; | ||
| flags = blocking ? (flags&~O_NONBLOCK) : (flags|O_NONBLOCK); | ||
| return (fcntl(fd, F_SETFL, flags) == 0) ? true : false; |
There was a problem hiding this comment.
My C is rusty but it appears we can omit the ternary operator here.
There was a problem hiding this comment.
Good catch! I copy pasted that code so not surprising.
|
Thanks for opening this PR! If accepted, it'll be exciting to use dvtm on macOS again. |
pselect() is broken on macOS. This isn't officially documented anywhere but there are hints of it in this article: https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/ To safely handle SIGCHLD/SIGWINCH without blocking them, use the "self-pipe" trick, i.e. write to a pipe when those signals occur and select() on the read-end of that pipe. Fixes martanne#19
|
edit: see comment below. |
|
@rianhunter apologies, I was mistakenly testing a version of @martanne anything we can do to get this PR merged? |
|
@rianhunter @martanne I can confirm that this patch works on High Sierra (10.13.1) with 311a8c0 (current HEAD). |
Reverting in favor of martanne#69. This reverts commit 52e85ef.
Reverting in favor of martanne#69. This reverts commit 97f2e0f.
|
Ping! This PR is necessary for allowing dvtm to work on macOS, and probably other unix like systems as well. pselect() is a bad linuxism. |
|
@martanne ping again :) |
|
Would love to get this merged. I've been using this patch on macOS and linux without issue for a while. |
|
@martanne ping again 🙏 |
|
Some further motivation for the self-pipe trick. |
|
Is this repo still maintained? It would be better to close this PR than ignore it indefinitely if it's not going to be accepted. |
|
I'm considering forking and dealing with the pull requests. It's a tool that I live in every single day
…-Ross
On March 18, 2019 1:16:54 PM EDT, Rian Hunter ***@***.***> wrote:
Is this repo still maintained? It would be better to close this PR than
ignore it indefinitely if it's not going to be accepted.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#69 (comment)
--
sent from phone
|
+1 |
pselect() is broken on macOS. This isn't officially documented
anywhere but there are hints of it in this article:
https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/
To safely handle SIGCHLD/SIGWINCH without blocking them,
use the "self-pipe" trick, i.e. write to a pipe when those signals
occur and select() on the read-end of that pipe.
Fixes #19