在Common Lisp中在后台运行函数的最佳方法是什么?具体来说,我正在打电话(trivial-shell:shell-command "<long and complicated command>"
。此操作阻塞了大约10秒钟,但是我不在乎输出,只在乎副作用-所以我希望它在后台运行,以便程序流可以继续。我尝试将整个内容包装在sb-thread:make-thread
中,但这似乎没有什么不同。
如果可能的话,我将避免陷入各种复杂的线程中。我在64位Gentoo Linux上运行SBCL 1.1.18。
最佳答案
我的小调查:看来唯一的解决方案是Renzo的答案:UIOP的launch-program函数。
否则,为了运行shell命令,有
run-program
,是同步的。 uiop:run-program
,因此只能同步运行,关于multithreading - 常见的Lisp : Run function in the background,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41319173/