[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help programming processes (monitoring subordinate processes)



    Date: Wed, 17 Jan 90 11:40:50 EST
    From: rpg@cs.brown.edu


    Unfortunately, I haven't been able to figure out how to monitor the
    subordinate process for the following conditions:
    -completion of function
    -error condition

The application we're developing uses background processes.  When one of
the background processes hits an error, we want to let the user know
there is a problem in the background, and which process is having
trouble.  We then allow the condition system to continue signalling
the error.  We do this by using process-interrupt.  When a background
process dies, it catches the error in a condition-bind, interrupts the
main process to say it is dying, and then goes into the debugger
normally.  This notion might be useful to you, and would free up your
main process from constantly monitoring the story process.  The
main process could just handle events from the story process when they
happen.

(defun dying-process (process)
  (beep)
  (format t "~% ***WARNING*** Process ~S Is Dying" (send process :name)))

(defun foo ()
  (condition-bind ((error
		     `(lambda (e)
			(process-interrupt *main-process*
					   'dying-process
					   si:*current-process*)
			;; return nil to keep signalling the error
			nil)))
    ...Your Code Here...))

Hope this helps.
-tom