Lisp HUG Maillist Archive

running function with timeout


I'm new to the MP package of Lispworks, so the following problem might 
have an easy answer:
In my application I call a function (to be precise, the solve function 
if the Maxima computer algebra system) which might take a long time. 
Thus, I want to make a call with a timeout, but I'm not sure, how to do 
this.
Here is what I tried:
(defun run-with-timeout (time &rest args) ; run for at most time seconds
(let ((timer nil))
  (setq timer
    (mp:make-timer
            'mp::process-kill
            (mp:process-run-function "max-solve-process"
                                         '(:priority 42)
                                         'do-all-the-work-in-maxima  args)
    ))
  (mp:schedule-timer-relative timer time 1)
  ))



This gets the work done, but I have not been able to provoke a situation 
where a long running calculation is actually killed. Do I need to 
scatter calls to process-allow-scheduling all over the Code in Maxima?

Reinhard


Re: running function with timeout

Unable to parse email body. Email id is 9329

Updated at: 2020-12-10 08:40 UTC