Repository navigation
Conversation
Add ProcessMonitor singleton that uses kernel mechanisms for instant process exit detection: - Linux: pidfd_open() + poll() (kernel 5.3+) - FreeBSD/OpenBSD/NetBSD: kqueue() + EVFILT_PROC + NOTE_EXIT - Fallback: kill(pid, 0) polling every 500ms The monitor runs on a dedicated thread and dispatches exit callbacks to the main thread via performSelectorOnMainThread. Closes gnustep#7
Author
|
Does not work yet:
|
The icon of an application that quit stayed in the Dock for seconds, because ProcessMonitor was added but never used, and it relied on blocks, which GCC builds lack. It now waits for process exits on a thread of its own with pidfd on Linux and kqueue on the BSDs and reports them on the main thread, and the Dock watches the processes of all running application items after every scan and every new window and scans again as soon as one of them exits. The process identifiers come from a single walk over the process table, which the scanner now provides and reuses for its other process queries.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instant detection of application exits through kernel process notifications:
pidfd_open()+poll(); BSDs:kqueue()withEVFILT_PROC/NOTE_EXIT; other systems fail to build instead of pollingNSThreadof its own and reports exits on the main thread (no blocks, no GCD)The first version added
ProcessMonitorbut never used it.Tested: after killing TextEdit its icon is gone within 0.4 s; without this change it was still there after 0.4 s.
Closes #7