<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hi I am trying to write an application that starts replicating files as they are being created by monitoring activity in a directory. I wrote the following code to test the possibility of reading data from a file that is open by another process.<DIV><BR class="khtml-block-placeholder"></DIV><DIV>(define (display-unless-eof line)</DIV><DIV>  (unless (eof-object? line)</DIV><DIV>    (display line)</DIV><DIV>    (newline)))</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>(define (keep-reading file)</DIV><DIV>  (display-unless-eof (read-line file))</DIV><DIV>  (keep-reading file))</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>(define temp-thread (thread (lambda () (keep-reading (open-input-file "~/dat")))))</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>(thread-suspend temp-thread)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The code above seems to do part of the job. What I need now is something to determine when the other process stop writing, so that I can kill the thread. </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>In openbsd there is a command fstat <A href="http://tinyurl.com/mxfv5">http://tinyurl.com/mxfv5</A> which I could wrap. But I was wondering if there is a way to this in a cross-platform manner, and in a more elegant way.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Any ideas are welcome. </DIV><DIV><FONT class="Apple-style-span" face="Courier" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;"><BR class="khtml-block-placeholder"></SPAN></FONT><DIV><DIV><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial"><SPAN class="Apple-style-span" style="font-family: Arial; ">-- <FONT class="Apple-style-span" face="Helvetica">Jaime </FONT></SPAN></FONT></DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></DIV></DIV></DIV></BODY></HTML>