How can I pause a thread or save an image of a thread in Common Lisp?

82 Views Asked by At

I'd like to be able to pause the execution of a computationally intensive thread when the user clicks a pause button and pick up where it left off when the user clicks on a button to resume computation. But I'd ideally also like to avoid busy waiting. One option is to serialize the state of the thread and terminate the thread when pausing. When resuming, I can start a new thread and deserialize the state of the prior thread.

However, it occurs to me that in Common Lisp I can save the state of a running program via something like (sb-ext:save-lisp-and-die) (SBCL). So I'm wondering if there's a way to use an implementation's built in functionality to store the state of a thread and reload it later. Is this possible? How? What are the advantages and disadvantages?

0

There are 0 best solutions below