sclass ManualTailFile extends TailFile { int checkEvery = 100; long lastCheck; Lock lock = lock(); *(final File *file, int *interval, fO *onData) {} // updates in this thread void check() { long l2 = 0; { lock lock; long now = sysNow(); if (now < lastCheck+checkEvery) ret; lastCheck = now; l2 = l(file); if (l2 < l) l = 0; // file shrunk (log rotated!) - start over from beginning of file if (l2 == l) hasIdled = true; else pcall { if (debug) print("New data in " + f2s(file) + ": " + n2(l2-l, "byte")); S text = null; l = l2; } } // call onData outside of locked part for (S s : loadTextFilePart_iterator(file, l, l2)) pcallF(onData, s); } }