Closed asmyers closed 10 years ago
Have you tried end-kernel
?
Shall I close this issue? The recommended strategy is to fully control the starting and stopping of kernels, which might include logic for stopping task creation when some condition is met. You also have access to the implementation-defined thread objects via the return value of end-kernel
.
This does work for me so if there is no better API then the issue can be closed. Thanks for the input.
Killing threads should really only be done in exceptional circumstances; the normal code path should gracefully end tasks and kernels. I would argue that this is the better strategy rather than being a workaround for lack of functionality in the lparallel API. But I could be overlooking a case where this is this difficult or too inconvenient. Could you describe your use case?
By default when a thread is created in Franz Lisp the image will not exit until the thread does. This behavior can be modified by
(setf (mp:process-keeps-lisp-alive-p thread) nil)
.The current default behavior of lparallel threads keeping lisp alive inhibits scripting of Lisp which uses lparallel. My workaround is currently:
There are a bunch of obvious problems with this but it's a hack that works for now. My personal preference for a change to lparallel for this is one of the following, in preferred order:
1) Start threads without the keep alive status. 2) Add some kind of option to make-kernel to disable keep alive status. 3) Provide a high level interface to get the threads in the kernel so I can manually change their keep alive status.
Is there some existing interface for this that I'm missing?