Skip to content

Watch a data link source with whatever the platform provides - #908

Open
DTW-Thalion wants to merge 1 commit into
gnustep:masterfrom
DTW-Thalion:fix/datalink-monitor-portable
Open

Watch a data link source with whatever the platform provides#908
DTW-Thalion wants to merge 1 commit into
gnustep:masterfrom
DTW-Thalion:fix/datalink-monitor-portable

Conversation

@DTW-Thalion

Copy link
Copy Markdown
Contributor

Fixes #898.

NSDataLinkManager watched source files with inotify, which only Linux has. Everywhere else the manager still built and still accepted links, so nothing reported that monitoring was not running: the delegate was never asked and a link never refreshed.

On Windows a change notification handle watches the directory a source file is in, and every link taking its source from there is reported. No modification date is consulted to confirm it, since an edit made in the same second as the reading before it leaves the date alone, and the delegate exists to decide whether the change matters.

Where there is neither, or a native one cannot start, a timer compares each source file's modification date and size.

All three end at one private method that runs on the main thread, so the delegate is still never messaged from the monitoring thread.

Tests/gui/NSDataLink on MSYS2 UCRT64, the platform of the Windows MinGW job: sourceMonitoring.m:98 failed before and 101 assertions pass after, the delegate asked 106ms after the write. On Linux the set gives 101 passed before and after, against the built library rather than the installed one.

@DTW-Thalion
DTW-Thalion force-pushed the fix/datalink-monitor-portable branch 2 times, most recently from 849958e to 3462e72 Compare August 11, 2026 20:42
NSDataLinkManager watched source files with inotify, which only Linux has. Everywhere else the manager still built and still accepted links, so nothing reported that monitoring was not running: the delegate was never asked and a link never refreshed.

On Windows a change notification handle watches the directory a source file is in, and every link taking its source from there is reported. The notification is the platform saying something in that directory changed, and no modification date is consulted to confirm it, since an edit made in the same second as the reading before it leaves the date alone and the delegate exists to decide whether the change matters.

Where there is neither mechanism, and where a native one cannot be started, a timer compares each source file modification date and size. The size is compared as well as the date for the same reason.

All three end at one private method that runs on the main thread, so the delegate is still never messaged from the monitoring thread.

Tests/gui/NSDataLink on MSYS2 UCRT64, the platform of the Windows MinGW job: sourceMonitoring.m line 98 failed before, and 101 assertions pass after, the delegate being asked 106ms after the write rather than not at all. On Linux the set gives 101 passed before and after, run against the built library rather than the installed one.
@DTW-Thalion
DTW-Thalion force-pushed the fix/datalink-monitor-portable branch from 3462e72 to 49fc3ed Compare August 12, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

A data link's source file is never monitored on Windows

1 participant