[Unison-hackers] [unison-svn] r506 - in trunk/src: . fsmonitor fsmonitor/linux fsmonitor/windows lwt lwt/win system

Jerome Vouillon Jerome.Vouillon at pps.jussieu.fr
Fri Aug 10 07:56:11 EDT 2012


On Thu, Aug 09, 2012 at 06:32:27PM -0400, Benjamin C. Pierce wrote:
> Any idea how hard it is to adapt the linux one to OSX?

In fact, you should adapt the Windows one, which uses a more similar
API (directories are watched recursively). Symlinks are dealt with in
the code shared by the different backends, so that comes for free.

There is a bit of work, but that should not be hard.

The main difficulty is that the Mac OS API needs its own run loop, so
it does not integrate well with Lwt. I think the simplest thing to do
is to have two threads and use pipes for signalling, a bit as in
there:

   http://cpansearch.perl.org/src/AGRUNDMA/Mac-FSEvents-0.04/FSEvents.xs

The other issue is that, before Mac OS 10.7, you only get the
directories in which changes happened but not what happened exactly.
I don't think it is worthwhile to put much effort in old Mac OS
versions, so we can probably just flag the directory to be rescan
entirely in this case.

-- Jerome


More information about the Unison-hackers mailing list