sunterlib/s48/concurrency/with-lock.scm

14 lines
337 B
Scheme
Raw Normal View History

2003-01-28 07:48:57 -05:00
;;; This file is part of the Scheme Untergrund Library.
;;; Copyright (c) 2002-2003 by Martin Gasbichler.
;;; For copyright information, see the file COPYING which comes with
;;; the distribution.
(define (with-lock lock thunk)
(dynamic-wind
(lambda ()
(obtain-lock lock))
2003-01-28 07:48:57 -05:00
thunk
(lambda ()
(release-lock lock))))