Skip to content

Commit

Permalink
Use SB-THREAD mutex for handle lock (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-s authored Dec 6, 2023
1 parent 04f7e39 commit 5ccf7e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion sbcl-librarian.asd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
(asdf:defsystem #:sbcl-librarian
:description "Tool for generating Lisp bindings."
:author "Charles Zhang <[email protected]>"
:depends-on (#:bordeaux-threads)
; :license "TODO"
; :version "0.0.1"
:in-order-to ((test-op (test-op "sbcl-librarian/tests")))
Expand Down
4 changes: 2 additions & 2 deletions src/handles.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
(defun handle-key (handle) (sb-alien::sap-int (sb-alien:alien-sap handle)))

(defvar *handle-lock*
(bt:make-lock "handle lock"))
(sb-thread:make-mutex :name "handle lock"))

(defun make-handle (object)
(bt:with-lock-held (*handle-lock*)
(sb-thread:with-mutex (*handle-lock*)
(let* ((handles *handles*)
(key (svref handles 1)))
(setf (gethash key (svref handles 0)) object)
Expand Down

0 comments on commit 5ccf7e6

Please sign in to comment.