1
0
Fork 0
tinmop/src/gui/client/program-events.lisp

22 lines
659 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-or-wait))))))