mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
remove lock and use atomic-incf
This commit is contained in:
parent
91b229133d
commit
91e228e3f6
2 changed files with 3 additions and 5 deletions
2
clog.asd
2
clog.asd
|
|
@ -9,7 +9,7 @@
|
|||
:depends-on (#:clack #:websocket-driver #:alexandria #:hunchentoot #:cl-ppcre
|
||||
#:bordeaux-threads #:trivial-open-browser #:parse-float #:quri
|
||||
#:lack-middleware-static #:lack-request #:lack-util-writer-stream
|
||||
#:closer-mop #:mgl-pax #:cl-template
|
||||
#:closer-mop #:mgl-pax #:cl-template #:atomics
|
||||
#:sqlite #:cl-dbi #:cl-pass #:cl-isaac)
|
||||
:components ((:module "static-files"
|
||||
:components ((:static-file "js/boot.js")))
|
||||
|
|
|
|||
|
|
@ -87,9 +87,7 @@ script."
|
|||
(defvar *connection-ids* (make-hash-table* :test #'equal) "IDs to connections")
|
||||
(defvar *connection-data* (make-hash-table* :test #'equal) "Connection based data")
|
||||
|
||||
(defvar *new-id* 0 "Last issued connection or script IDs")
|
||||
(defvar *id-lock* (bordeaux-threads:make-lock)
|
||||
"Protect new-id variable.")
|
||||
(defvar *new-id* '(0) "Last issued connection or script IDs")
|
||||
|
||||
#-(or mswindows win32 cormanlisp) ; isaac hasn't supported these platforms
|
||||
(defparameter *isaac-ctx*
|
||||
|
|
@ -126,7 +124,7 @@ script."
|
|||
|
||||
(defun generate-id ()
|
||||
"Generate unique ids for use in scripts."
|
||||
(bordeaux-threads:with-lock-held (*id-lock*) (incf *new-id*)))
|
||||
(atomics:atomic-incf (car *new-id*)))
|
||||
|
||||
;;;;;;;;;;;;;;;;:;;;;;;
|
||||
;; random-hex-string ;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue