Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!necntc!ames!ptsfa!ihnp4!cbosgd!osu-cis!tut!karl From: karl@tut.cis.ohio-state.edu (Karl Kleinpaste) Newsgroups: comp.unix.wizards Subject: Re: tty hangs in ^S state was (Re: Killing the printer daemon) Message-ID: <212@tut.cis.ohio-state.edu> Date: Fri, 25-Sep-87 08:31:32 EDT Article-I.D.: tut.212 Posted: Fri Sep 25 08:31:32 1987 Date-Received: Sun, 27-Sep-87 02:04:47 EDT References: <2419@drivax.UUCP> <366@cogen.UUCP> Organization: Ohio State Computer & Info Science Lines: 20 alen@cogen.UUCP writes: I've had a similar problem before, the printer was on a serial interface and the printer died when the line was in a ^S state. The daemon process which was in an i/o pending state would not die until we attached a tty and typed ^Q at it!!!! The reason for this race condition is due to the fact that the tty driver is trying to close as the process exits. Closing the tty implies that its output q must be drained first. Hence, if the output q drain is prevented by a TTSTOP state with ^S, the close will not complete. A proper solution to this problem is to set a timeout for the close to complete, preferably in proportion to the number of characters waiting to be drained and the speed in use on the line; if the timeout expires, force the tty to flush rather than drain, and allow the close to complete. I was going to do this once in a SysIII PDP-11, had it all ready to test and integrate, but never actually finished the job. -- Karl