Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2548,8 +2548,8 @@ public void runHotkeyReaderThread(ThreadPoolExecutor executor) {
// it's available
inputUnavailable.wait(500);
}
printDevModeMessages(inputUnavailable.get(), firstStartup);
firstStartup = false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why we don't need to clear this boolean anymore? The comment says "If the thread is already running..." so it makes me wonder if firstStartup is always false by the time this is called.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The firstStartup is always false by the time runHotkeyReaderThread() is reached. watchFiles() sets firstStartup = false before entering the watch loop via initWatchLoop(). The only call site for runHotkeyReaderThread() in ci.common is inside TestJob.run(), which runs after the watch loop is active, so watchFiles() has always completed by then. The old code reset it here to cover the premature call from DevMojo/DevTask before watchFiles() ran. That premature call is the race condition we are removing, and without it the reset is no longer needed.

// firstStartup is false by the time this is called after initial startup.
printDevModeMessages(inputUnavailable.get(), false);
} catch (InterruptedException e) {
debug("Interrupted while waiting to determine whether input can be read", e);
} catch (PluginExecutionException pe) {
Expand Down Expand Up @@ -3177,6 +3177,17 @@ public void watchFiles(File outputDirectory, File testOutputDirectory, final Thr
}
}

if (firstStartup) {
synchronized (inputUnavailable) {
try {
printDevModeMessages(inputUnavailable.get(), true);
} catch (PluginExecutionException pe) {
error(pe.getMessage());
}
}
firstStartup = false;
}

initWatchLoop();

while (true) {
Expand Down
Loading