mirror of https://codeberg.org/cage/tinmop/
22 lines
651 B
Common Lisp
22 lines
651 B
Common Lisp
(in-package :client-events)
|
|
|
|
(defparameter *stop-events-loop* t)
|
|
|
|
(defparameter *events-loop-lock* (bt:make-lock "events-loop-lock"))
|
|
|
|
(defun events-loop-running-p ()
|
|
(misc:with-lock (*events-loop-lock*)
|
|
(not *stop-events-loop*)))
|
|
|
|
(defun stop-events-loop ()
|
|
(misc:with-lock (*events-loop-lock*)
|
|
(setf *stop-events-loop* t)))
|
|
|
|
(defun start-events-loop ()
|
|
(misc:with-lock (*events-loop-lock*)
|
|
(setf *stop-events-loop* nil))
|
|
(bt:make-thread (lambda ()
|
|
(loop while (events-loop-running-p) do
|
|
(when (not (ev:stop-event-dispatching-p))
|
|
(ev:dispatch-program-events))))))
|