[Unison-hackers] Unix.sleep insufficient for -repeat! Need half seconds.

Benjamin Pierce bcpierce at cis.upenn.edu
Fri Apr 20 11:54:33 EDT 2007


I'd be very happy to see this change.  Couple of thoughts:

* One reason that usleep is not wrapped for OCaml might be (I don't  
know) that Win32 doesn't offer something comparable.  Whatever  
solution is adopted here needs to at least compile cross-platform,  
even if the full functionality isn't available everywhere.  And it  
needs to degrade in a graceful way.

* It might also be worth considering using the new extension of the  
"repeat" functionality to save processor and disk load (unless it is  
really just a couple of files that you want to watch) by getting the  
filesystem to notify Unison (via an external watcher program that, at  
the moment, still needs to be written!) when it should look for  
changes.  However, making Unison sleep for fractions of a second will  
also be needed for this scenario, so your proposed change is the  
place to start.

Regards,

     - Benjamin


On Apr 20, 2007, at 10:19 AM, Ryan Newton wrote:

> Hello all,
>
> I use the -repeat option *extensively* to establish a relatively low-
> bandwidth, poor man's distributed file system.  Basically, if my
> connection is good enough, I do development by running emacs over X11
> forwarding from the server.  If it's not good enough, I run emacs
> locally, use unison -repeat, and compile/run the program on the
> server over a simple ssh terminal.
>
> I imagine many others use unison for this same purpose.
>
> The problem is:  "unison -repeat 1" is too slow!  And "unison -repeat
> 0" is too fast and too hard on both systems.  I need unison -repeat  
> 0.5.
>
> Of course, uitext.ml uses Unix.sleep, which will only sleep an
> integral number of seconds.  To my knowledge, the standard OCaml
> libraries don't include anything like C's "usleep".
>
> However, I argue that wrapping usleep for Caml is easy, and worth
> doing!  Besides, I see that the unison repository already has some
> dependencies on C code.
>
> Are there any objections to this small modification?  I haven't
> hacked unison before, but I might try making this change, in which
> case I'll submit a patch to this list.
>
> Best,
> -Ryan
>
> _______________________________________________
> Unison-hackers mailing list
> Unison-hackers at lists.seas.upenn.edu
> http://lists.seas.upenn.edu/mailman/listinfo/unison-hackers



More information about the Unison-hackers mailing list