Skip to content

win,signal: fix data race dispatching SIGWINCH#4488

Merged
vtjnash merged 1 commit intolibuv:v1.xfrom
vtjnash:jn/SIGWINCH
Aug 5, 2024
Merged

win,signal: fix data race dispatching SIGWINCH#4488
vtjnash merged 1 commit intolibuv:v1.xfrom
vtjnash:jn/SIGWINCH

Conversation

@vtjnash
Copy link
Copy Markdown
Member

@vtjnash vtjnash commented Aug 2, 2024

The Event should be reset before reading the value, or libuv might miss an update that occurred too rapidly after the previously one.

This thread and the delay here seems to have been added in #2381 by @bzoz, but I don't see a justification there for why 30 fps is correct, or why libuv shouldn't just assume the system will limit to the USB polling and thread-switching frequencies anyways. In libuv, it seems to be causing strictly more work for the system by limiting it to 30 fps, since it has to jump through an extra thread, when SIGWINCH should be coalescing these events anyways. I am somewhat inclined thus to say we should just delete the extra thread and the delay (alternatively, libuv could also use MsgWaitForMultipleEvents with a 33 ms timeout to avoid the thread in the implementation). Additionally, since this hook has been known to cause some performance problems for the rest of the OS, we may want to consider deactivating the hook whenever SIGWINCH is not active, and reactivating it only when SIGWINCH is active.

Refs: #4485

The Event should be reset before reading the value, or libuv might miss
an update that occurred too rapidly after the previously one.

Refs: libuv#2381
Refs: libuv#4485
@vtjnash vtjnash merged commit a6a987c into libuv:v1.x Aug 5, 2024
@vtjnash vtjnash deleted the jn/SIGWINCH branch August 5, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants