[plt-scheme] File Locks

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Aug 11 06:16:22 EDT 2005

On Aug 11, Matt Jadud wrote:
> [...]
> (define-syntax forever
>    (lambda (stx)
>      (syntax-case stx ()
>        [(forever bodies ...)
>         #`(let loop ()
>             #,@(syntax->list (syntax (bodies ...)))
>             (loop))])))

Um, any need for this huge block of verbosity?  Seems like this is a
simple:

  (define-syntax forever
    (syntax-rules ()
      [(forever bodies ...)
       (let loop () bodies ... (loop))]))

In any case, your solution will obviously work as long as there is a
single process that tries to write to the file.  DrScheme uses a
lockfile for preferences in case you're running several instances.

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



Posted on the users mailing list.