mirror of
https://github.com/rabbibotton/clog.git
synced 2026-04-27 07:30:54 -07:00
Added mutex on generate-id.
This commit is contained in:
parent
0029135c0a
commit
8cce7ee5ae
1 changed files with 3 additions and 1 deletions
|
|
@ -66,6 +66,8 @@ script."
|
|||
"Protect the connection hash tables")
|
||||
(defvar *queries-lock* (bordeaux-threads:make-lock)
|
||||
"Protect query hash tables")
|
||||
(defvar *id-lock* (bordeaux-threads:make-lock)
|
||||
"Protect new-id variable.")
|
||||
|
||||
(defvar *queries* (make-hash-table) "Query ID to Answers")
|
||||
(defvar *queries-sems* (make-hash-table) "Query ID to semiphores")
|
||||
|
|
@ -78,7 +80,7 @@ script."
|
|||
(defun generate-id ()
|
||||
"Generate unique ids for use in connections and sripts."
|
||||
;; needs mutex or atomic
|
||||
(incf *new-id*))
|
||||
(bordeaux-threads:with-lock-held (*id-lock*) (incf *new-id*)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;
|
||||
;; get-connection ;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue