[Openmcl-devel] Named Processes

Sven Van Caekenberghe sven at beta9.be
Wed Nov 20 09:11:35 PST 2002


I am sure Gary could answer this question better, but since I just had 
the same problem I'll give it a try ;-)

The reason your process needs access to terminal input is most probably 
because your process' code threw an error (condition) that is being 
handled by the toplevel debugger, which in general will ask you what to 
do (how to continue), hence needs terminal input. Another possible 
reason is that your own code does a (read).

If you want to see what's going on, do a (:y <name>) to transfer 
control to the process wanting access to terminal input.

To prevent this behavior to errors, implement your own handler using 
#'handler-read. This is an example from some testing code that I wrote:

(defun network-time-server (&key (port *port*) (verbose nil))
   "Start a network time server."
   (process-run-function (format nil "network-time-server:~d" port)
			#'network-time-server-core
		        port
			verbose))

(defun network-time-server-core (port verbose)
   "The actual network time server core loop: accepting connections."
   (handler-bind ((error #'(lambda (c)
			    (format t "network time server failed with ~a~%" c)
			    (return-from network-time-server-core nil))))
     (with-open-socket (server-socket :connect :passive
				     :local-port port
				     :reuse-address t)
       (when verbose
	(format t "network time server ~a:~d ready~%"
		(ipaddr-to-dotted (local-host server-socket))
		port))
       (do ((client-socket (accept-connection server-socket)
			  (accept-connection server-socket)))
	  (nil nil)
	(when verbose
	  (format t "accepted connection from ~a~%"
		  (ipaddr-to-dotted (remote-host client-socket))))
	(let ((id (incf *counter*)))
	  (process-run-function (format nil "network-time-request-handler-~d" 
id)
				#'network-time-request-handler
				client-socket
				verbose
				id))))))

Simply printing the error and returning from your process' run function 
will end the process.

Sven

On Wednesday, November 20, 2002, at 05:53 PM, Marco Antoniotti wrote:

> Yep.  I use that.  However, my process seem to block saying
>
> ;;
> ;; Process <name> needs access to terminal input.
> ;;
>
> How do I suppress this behavior?  I tried
>
>     (process-run-function <name> '(:input nil) #'procfun)
>
> to no avail.
>
> Would this be the correct way to produce that effect?
>
--
Sven Van Caekenberghe - mailto:sven at beta9.be
Beta Nine - software engineering - http://www.beta9.be
.Mac - svc at mac.com - http://homepage.mac.com/svc


_______________________________________________
Openmcl-devel mailing list
Openmcl-devel at clozure.com
http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel



More information about the Openmcl-devel mailing list