chickadee » synch » record-synch

(record-synch RECORD-OBJECT RECORD-SYMBOL [BODY ...]) -> *syntax

Execute BODY ... while the RECORD-OBJECT mutex is locked. The mutex is a field of the record named RECORD-SYMBOL-mutex.

Returns the result of BODY ....

(define-record-type foo
  (make-foo a b mtx)
  foo?
  (a foo-a)
  (b foo-b)
  (mtx foo-mutex) )

(define f1 (make-foo 1 2 (make-mutex 'foo)))

(record-synch foo f1 (+ (foo-a f1) (foo-b f1)))