Native file watcher threads stay attached to the JVM even after watcher stops
Closed this issue · 0 comments
lptr commented
In both the Windows and the macOS file watcher the native thread is attached to the JVM every time an event is received. This has two problems:
-
we are doing unnecessary work, slowing down event delivery
-
since we never detach the native thread, the JVM is left alive even after all other threads exit, as the (already stopped) native thread is still represented as a
RUNNING
JVM thread:"DestroyJavaVM@679" prio=5 tid=0x16 nid=NA runnable java.lang.Thread.State: RUNNABLE "Thread-0@677" prio=5 tid=0x15 nid=NA runnable java.lang.Thread.State: RUNNABLE
Attaching should happen when we start the watcher thread, and detaching should happen when we stop the thread.