~ chicken-core (chicken-5) 643c48869d064ff441054c97c2909988614e89cb
commit 643c48869d064ff441054c97c2909988614e89cb
Author: Peter Bex <peter@more-magic.net>
AuthorDate: Thu Feb 6 15:42:11 2025 +0100
Commit: Peter Bex <peter@more-magic.net>
CommitDate: Thu Feb 6 15:42:11 2025 +0100
Simplify call to maybe-kill-others a bit
Instead of having two branches both call into it, call it with only
the argument differing. This clarifies the intent a bit better.
diff --git a/posixunix.scm b/posixunix.scm
index 8b8757be..48c7a904 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -1114,17 +1114,16 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
(posix-error #:process-error 'process-fork "cannot create child process"))
((fx= 0 pid) ; child process
(set! children '())
- (cond (thunk
- (maybe-kill-others (lambda ()
- (##sys#call-with-cthulhu
- (lambda ()
- (thunk)
- ;; Make sure to run clean up tasks.
- ;; NOTE: ##sys#call-with-cthulhu will invoke
- ;; a more low-level runtime C_exit_runtime(0)
- (exit 0))))))
- (else
- (maybe-kill-others (lambda () #f)))))
+ (maybe-kill-others (if thunk
+ (lambda ()
+ (##sys#call-with-cthulhu
+ (lambda ()
+ (thunk)
+ ;; Make sure to run clean up tasks.
+ ;; NOTE: ##sys#call-with-cthulhu will invoke
+ ;; a more low-level runtime C_exit_runtime(0)
+ (exit 0))))
+ (lambda () #f))))
(else ; parent process
(register-pid pid)))))))
Trap