[plt-scheme] Thread synchronization for dummies

From: Erich Rast (erich at snafu.de)
Date: Thu May 28 15:45:17 EDT 2009


>
> (define-syntax define-synchronized
>  (syntax-rules ()
>    [(_ (name args ...) body ...)
>     (define name
>       (let ((m (make-semaphore 1)))
>         (λ(args ...)
>           (semaphore-wait m)
>           body ...
>           (semaphore-post m))))]))

That's indeed exactly what I was looking for! Looking at it, it seems  
easy, but it'd probably taken me days to write this on my own. (I  
currently only have some limited spare for doing programming.)

Thanks a lot to both of you!

Best,

Erich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090528/89738460/attachment.html>

Posted on the users mailing list.