1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 14:00:21 +02:00

remove mutex in make-object-property

* module/ice-9/boot-9.scm (make-object-property): Remove the mutex; weak
  tables are now threadsafe.
This commit is contained in:
Andy Wingo 2011-10-24 10:55:46 +02:00
parent a141db8604
commit 633f3a18b7

View file

@ -886,15 +886,11 @@ VALUE."
;; properties within the object itself.
(define (make-object-property)
(define-syntax-rule (with-mutex lock exp)
(dynamic-wind (lambda () (lock-mutex lock))
(lambda () exp)
(lambda () (unlock-mutex lock))))
(let ((prop (make-weak-key-hash-table))
(lock (make-mutex)))
;; Weak tables are thread-safe.
(let ((prop (make-weak-key-hash-table)))
(make-procedure-with-setter
(lambda (obj) (with-mutex lock (hashq-ref prop obj)))
(lambda (obj val) (with-mutex lock (hashq-set! prop obj val))))))
(lambda (obj) (hashq-ref prop obj))
(lambda (obj val) (hashq-set! prop obj val)))))