diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-23 21:54:19 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-23 21:54:19 -0700 |
commit | 494f8eb820eb22e5920baa5764660a2ac5dc2824 (patch) | |
tree | 9fd5e5b8b4de607abfc123bd71229a3902fce0bb /src/connection/fork.lisp | |
parent | a8047da6699c8dfcb281e422689c8003305768a8 (diff) | |
download | consfigurator-494f8eb820eb22e5920baa5764660a2ac5dc2824.tar.gz |
move CAN-PROBABLY-FORK to CONNECTION.FORK
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/connection/fork.lisp')
-rw-r--r-- | src/connection/fork.lisp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/connection/fork.lisp b/src/connection/fork.lisp index 702ca96..6a4ad0c 100644 --- a/src/connection/fork.lisp +++ b/src/connection/fork.lisp @@ -31,6 +31,16 @@ ;; (values PID EXIT-STATUS), as SB-POSIX:WAITPID does #+sbcl (sb-posix:waitpid pid options)) +(defun can-probably-fork () + "Return nil if we can detect other running threads, and the Lisp +implementation is known not to support forking when there are other threads. +A return value other than nil indicates only that we couldn't detect +circumstances in which it is known that we cannot fork, not that we are sure +we can fork -- a thread might be only partly initialised at the time we check, +for example, such that we don't see it." + (and + #+sbcl (> 2 (length (sb-thread:list-all-threads))))) + (defmacro with-fork-connection ((remaining) &body forms) `(progn (unless (lisp-connection-p) |