With a function that calls an asynchronous process, it's possible to call the same function multiple times.
What is a reliable way to avoid this that properly handles quit
and errors being raised?
Is there an lisp convention for how to handle this?
This is an example of locking function, I'm wondering if there are better ways to handle this (existing macros or conventions for e.g).
(defvar my-fn--lock nil)
(defun my-fn ()
(unless my-fn--lock
(unwind-protect
(progn
(setq my-fn--lock t)
;; Code body.
(do-stuff))
;; Protected.
(setq my-fn--lock nil))))