[racket-dev] the preferences file under Windows

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Jan 14 10:57:22 EST 2011

20 minutes ago, Matthew Flatt wrote:
> The `racket/file' library now provides `preferences-lock-file-mode',
> which reports the style of locking being used. DrRacket, for
> example, may need to use that function --- instead of testing
> whether the current platform is Windows --- to determine whether it
> can try to steal a lock by deleting the lock file. (As far as I
> know, there's no way to steal a Windows-implemented file lock. The
> lock will be released when the holding process is terminated.)
> 
> The default handling of lock errors in `get-preference' is to wait a
> little while and try again. On the first failure, the handler waits
> 0.01 seconds, then it waits 0.02 seconds, then 0.04 seconds, then 0.08
> seconds, then 0.16 seconds, and then it gives up with an exception.
> This default is implemented by a `make-handle-get-preference-locked'
> function provided by `racket/file'.

Not too important now, but wouldn't it be easier to do the same thing
on unix using flock()?

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the dev mailing list.