Skip to content

perf: block idle Windows and Linux tray loops - #447

Closed
nyxiereal wants to merge 1 commit into
NucleusFramework:masterfrom
nyxiereal:perf/block-tray-message-loops
Closed

nyxiereal wants to merge 1 commit into
NucleusFramework:masterfrom
nyxiereal:perf/block-tray-message-loops

Conversation

@nyxiereal

Copy link
Copy Markdown

Idle tray loops currently wake about 20 times per second on Windows and once per second on Linux. Windows now waits with MsgWaitForMultipleObjectsEx and receives PostThreadMessage wakeups for queued updates and shutdown. Its bounded startup position retries remain. Linux uses poll with sd-bus readiness and deadlines, plus a nonblocking eventfd for updates and shutdown. Menu and icon updates stay on their existing threads, and a terminal Windows quit exits the loop.

The Linux native build, JVM JAR, JVM tests and ktlintCheck passed. A private D-Bus check verified zero idle wakeups over 2.2 seconds, update wakeups, icon/menu changes, callbacks and shutdown; the original code woke twice in the same interval. The existing 200,000-round concurrency test passed. The Windows JNI bridge cross-compiled with MinGW, but the full Windows DLL and runtime behavior were not verified. Desktop tray behavior on GNOME/KDE was not tested.

@kdroidFilter

Copy link
Copy Markdown
Collaborator

Thank you! The code of this library now lives in the Nucleus repository (tray and tray-app modules), see the README and the migration guide. Nucleus already has this: the Windows tray thread waits in MsgWaitForMultipleObjectsEx(INFINITE) and wakes on demand, and the Linux one polls an eventfd and the sd-bus timeout. Closing here.

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