mirror of https://codeberg.org/cage/tinmop/
- replaced occurences of 'with-lock' with 'misc:with-lock-held'.
This commit is contained in:
parent
5155749080
commit
e4d9ab9fd0
|
@ -51,7 +51,7 @@
|
|||
(find-db-stream-if (lambda (a) (string= (download-iri a) url))))
|
||||
|
||||
(defun ensure-just-one-stream-rendering ()
|
||||
(with-lock (*gemini-db-streams-lock*)
|
||||
(with-lock-held (*gemini-db-streams-lock*)
|
||||
(when-let ((current-rendering (find-db-stream-if (lambda (a)
|
||||
(eq (stream-status a)
|
||||
:rendering)))))
|
||||
|
@ -226,28 +226,28 @@
|
|||
(defmethod abort-downloading ((object gemini-stream))
|
||||
(with-accessors ((download-thread-lock download-thread-lock)) object
|
||||
(setf (stream-status object) :aborted)
|
||||
(with-lock (download-thread-lock)
|
||||
(with-lock-held (download-thread-lock)
|
||||
(setf (download-thread-blocked object) t))))
|
||||
|
||||
(defmethod allow-downloading ((object gemini-stream))
|
||||
(with-accessors ((download-thread-lock download-thread-lock)) object
|
||||
(with-lock (download-thread-lock)
|
||||
(with-lock-held (download-thread-lock)
|
||||
(setf (download-thread-blocked object) nil))))
|
||||
|
||||
(defmethod downloading-allowed-p ((object gemini-stream))
|
||||
(with-accessors ((download-thread-lock download-thread-lock)) object
|
||||
(with-lock (download-thread-lock)
|
||||
(with-lock-held (download-thread-lock)
|
||||
(not (download-thread-blocked-p object)))))
|
||||
|
||||
(defmethod (setf stream-status) (val (object gemini-stream))
|
||||
(with-accessors ((download-thread-lock download-thread-lock)
|
||||
(stream-status stream-status)) object
|
||||
(with-lock (download-thread-lock)
|
||||
(with-lock-held (download-thread-lock)
|
||||
(setf (slot-value object 'stream-status) val))))
|
||||
|
||||
(defmethod stream-status ((object gemini-stream))
|
||||
(with-accessors ((download-thread-lock download-thread-lock)) object
|
||||
(with-lock (download-thread-lock)
|
||||
(with-lock-held (download-thread-lock)
|
||||
(slot-value object 'stream-status))))
|
||||
|
||||
(defmethod downloading-start-thread ((object gemini-stream)
|
||||
|
@ -276,7 +276,7 @@
|
|||
(with-accessors ((download-thread-lock download-thread-lock)
|
||||
(support-file support-file)
|
||||
(parsed-lines parsed-lines)) object
|
||||
(with-lock (download-thread-lock)
|
||||
(with-lock-held (download-thread-lock)
|
||||
(gemini-parser:with-initialized-parser
|
||||
(let ((event (make-gemini-download-event (fs:slurp-file support-file)
|
||||
parsed-lines
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
(defgeneric make-request (method id &rest args))
|
||||
|
||||
(defmethod make-request ((method symbol) id &rest args)
|
||||
(misc:with-lock (*request-lock*)
|
||||
(misc:with-lock-held (*request-lock*)
|
||||
(apply #'make-request (string-downcase (symbol-name method)) id args)))
|
||||
|
||||
(define-condition rpc-error-response (conditions:text-error)
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
(defgeneric streaming-url (object))
|
||||
|
||||
(defmethod status ((object gemini-stream))
|
||||
(misc:with-lock ((status-lock object))
|
||||
(misc:with-lock-held ((status-lock object))
|
||||
(slot-value object 'status)))
|
||||
|
||||
(defmethod (setf status) ((object gemini-stream) val)
|
||||
(misc:with-lock ((status-lock object))
|
||||
(misc:with-lock-held ((status-lock object))
|
||||
(setf (slot-value object 'status) val)
|
||||
val))
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
|||
(defparameter *gemini-streams-db-lock* (make-lock "gemini-streams-db-lock"))
|
||||
|
||||
(defun push-db-stream (stream-object)
|
||||
(misc:with-lock (*gemini-streams-db-lock*)
|
||||
(misc:with-lock-held (*gemini-streams-db-lock*)
|
||||
(pushnew stream-object
|
||||
*gemini-streams-db*
|
||||
:test (lambda (a b)
|
||||
|
@ -49,7 +49,7 @@
|
|||
*gemini-streams-db*))
|
||||
|
||||
(defun remove-db-stream (stream-object)
|
||||
(misc:with-lock (*gemini-streams-db-lock*)
|
||||
(misc:with-lock-held (*gemini-streams-db-lock*)
|
||||
(setf *gemini-streams-db*
|
||||
(remove stream-object *gemini-streams-db*))
|
||||
*gemini-streams-db*))
|
||||
|
@ -58,7 +58,7 @@
|
|||
(setf (status object) +stream-status-canceled+))
|
||||
|
||||
(defun remove-all-db-stream ()
|
||||
(misc:with-lock (*gemini-streams-db-lock*)
|
||||
(misc:with-lock-held (*gemini-streams-db-lock*)
|
||||
(map nil
|
||||
(lambda (a) (abort-downloading a))
|
||||
*gemini-streams-db*)
|
||||
|
@ -66,7 +66,7 @@
|
|||
*gemini-streams-db*))
|
||||
|
||||
(defun find-db-stream-if (predicate)
|
||||
(misc:with-lock (*gemini-streams-db-lock*)
|
||||
(misc:with-lock-held (*gemini-streams-db-lock*)
|
||||
(find-if predicate *gemini-streams-db*)))
|
||||
|
||||
(defun find-db-stream-url (url)
|
||||
|
@ -1519,11 +1519,11 @@ local file paths."
|
|||
(defgeneric fit-toc-char-width (object new-width))
|
||||
|
||||
(defmethod interrupt-rendering-p ((object main-frame))
|
||||
(misc:with-lock ((interrupt-rendering-lock object))
|
||||
(misc:with-lock-held ((interrupt-rendering-lock object))
|
||||
(slot-value object 'interrupt-rendering)))
|
||||
|
||||
(defun set-interrupt-rendering-state (main-frame value)
|
||||
(misc:with-lock ((interrupt-rendering-lock main-frame))
|
||||
(misc:with-lock-held ((interrupt-rendering-lock main-frame))
|
||||
(setf (slot-value main-frame 'interrupt-rendering) value)))
|
||||
|
||||
(defmethod interrupt-rendering ((object main-frame))
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
(defparameter *events-loop-thread* nil)
|
||||
|
||||
(defun events-loop-running-p ()
|
||||
(misc:with-lock (*events-loop-lock*)
|
||||
(misc:with-lock-held (*events-loop-lock*)
|
||||
(not *stop-events-loop*)))
|
||||
|
||||
(defun stop-events-loop ()
|
||||
(misc:with-lock (*events-loop-lock*)
|
||||
(misc:with-lock-held (*events-loop-lock*)
|
||||
(setf *stop-events-loop* t))
|
||||
#+debug-mode (misc:dbg "Stopping gui event thread")
|
||||
(ev:with-enqueued-process-and-unblock ()
|
||||
|
@ -19,7 +19,7 @@
|
|||
#+debug-mode (misc:dbg "Stopped gui event thread"))
|
||||
|
||||
(defun start-events-loop ()
|
||||
(misc:with-lock (*events-loop-lock*)
|
||||
(misc:with-lock-held (*events-loop-lock*)
|
||||
(setf *stop-events-loop* nil))
|
||||
(setf *events-loop-thread*
|
||||
(make-thread (lambda ()
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
(defmacro wrapped-in-lock ((queue) &body body)
|
||||
(with-gensyms (lock)
|
||||
`(with-accessors ((,lock lock)) ,queue
|
||||
(with-lock (,lock)
|
||||
(with-lock-held (,lock)
|
||||
,@body))))
|
||||
|
||||
(defclass events-queue (priority-queue)
|
||||
|
@ -152,7 +152,7 @@
|
|||
object))
|
||||
|
||||
(defun pop-event-block ()
|
||||
(with-lock ((blocking-lock *events-queue*))
|
||||
(with-lock-held ((blocking-lock *events-queue*))
|
||||
(loop while (emptyp *events-queue*)
|
||||
do
|
||||
(condition-wait (condition-variable *events-queue*)
|
||||
|
@ -160,7 +160,7 @@
|
|||
(pop-element *events-queue*)))
|
||||
|
||||
(defun push-event-unblock (value)
|
||||
(with-lock ((blocking-lock *events-queue*))
|
||||
(with-lock-held ((blocking-lock *events-queue*))
|
||||
(push-element *events-queue* value)
|
||||
(condition-notify (condition-variable *events-queue*))))
|
||||
|
||||
|
@ -249,11 +249,11 @@
|
|||
(handler-case
|
||||
(progn
|
||||
(setf (box:unbox results) (funcall callback))
|
||||
(with-lock (lock)
|
||||
(with-lock-held (lock)
|
||||
(condition-notify condition-variable)))
|
||||
(error (e)
|
||||
(setf (box:unbox results) e)
|
||||
(with-lock (lock)
|
||||
(with-lock-held (lock)
|
||||
(condition-notify condition-variable))))))
|
||||
|
||||
(defun push-function-and-wait-results (fn &key
|
||||
|
@ -265,7 +265,7 @@
|
|||
(lock (lock event))
|
||||
(condition-variable (condition-variable event)))
|
||||
(funcall push-event-fn event)
|
||||
(with-lock (lock)
|
||||
(with-lock-held (lock)
|
||||
(loop
|
||||
while (eq (box:unbox (results event)) :nothing)
|
||||
do
|
||||
|
@ -344,7 +344,7 @@
|
|||
(condition-variable condition-variable)) object
|
||||
(setf (command-window:echo-character specials:*command-window*)
|
||||
:completed)
|
||||
(with-lock (lock)
|
||||
(with-lock-held (lock)
|
||||
(condition-notify condition-variable))))
|
||||
|
||||
(defclass notify-user-event (program-event)
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
(with-accessors ((lock program-events::lock)
|
||||
(condition-variable program-events::condition-variable)) event
|
||||
(push-event event)
|
||||
(with-lock (lock)
|
||||
(with-lock-held (lock)
|
||||
(format t "wait!~%")
|
||||
(condition-wait condition-variable lock)
|
||||
(format t "input was ~a~%" (dunbox (payload event)))))))
|
||||
|
|
|
@ -241,7 +241,7 @@
|
|||
(with-accessors ((lock lock)
|
||||
(condition-variable condition-variable)) event
|
||||
(push-event event)
|
||||
(with-lock (lock)
|
||||
(with-lock-held (lock)
|
||||
(loop
|
||||
while (not (eq (command-window:echo-character *command-window*)
|
||||
:completed))
|
||||
|
|
Loading…
Reference in New Issue