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

multiprocessing scheduling



hello:

could someone who has experience with extended common lisp multiprocessing
facilities please explain how to properly cause a suspended process to
be restarted.

i am attempting to construct an event processing loop to handle CLX events
by making a new process, running it and having it suspend until there are
events in the queue.

the method i have used (see below) causes the event loop to resume only after
there has been input to terminal io but before the listener process has run.
i had thought that both of these processes would be suspended due to calls
to process-wait, and that the first one with input would be resumed.

the event loop is started as follows:

  (when (not (mp:process-lock-locker *clx-process-lock*))
    (mp:process-run-function
     "CLX event processor"
     #'(lambda ()
	 (setf (mp:process-priority mp:*current-process*) 1)
	 (mp:process-lock *clx-process-lock*)
	 (loop
	  (mp:process-wait
	   :no-input
	   #'(lambda ()
	       (if (and (xlib:display-p *the-%display*)
			(not (xlib::buffer-dead *the-%display*)))
		 (xlib:event-listen *the-%display* 0)
		 t)))
	  #|(mp:process-wait :no-input
                             #'xlib::listen-fd
                             (xlib::display-input-stream *the-%display*)) |#
  	  (if (not (xlib:display-p *the-%display*)) (return))
	  (event-dispatch))
	 (mp:process-unlock *clx-process-lock*)
	 (mp:process-kill mp:*current-process*))))

in which the commented code - as suggested by j.irwin - shows the same
behavior.

whats missing?

yours,
james anderson.