From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19402 invoked from network); 21 Aug 2001 15:36:28 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 21 Aug 2001 15:36:28 -0000 Received: (qmail 1252 invoked by alias); 21 Aug 2001 15:36:10 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4159 Received: (qmail 1236 invoked from network); 21 Aug 2001 15:36:08 -0000 From: Bart Schaefer Message-Id: <1010821153422.ZM21739@candle.brasslantern.com> Date: Tue, 21 Aug 2001 15:34:21 +0000 In-Reply-To: <20010821152154.A8668@popov.bri.st.com> Comments: In reply to Richard Curnow "Re: Zsh Guide chapter 5 (substitutions)" (Aug 21, 3:21pm) References: <20010815230024.3E7F614284@pwstephenson.fsnet.co.uk> <20010821152154.A8668@popov.bri.st.com> X-Mailer: Z-Mail (5.0.0 30July97) To: Richard Curnow , zsh-users@sunsite.dk Subject: Re: Zsh Guide chapter 5 (substitutions) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Aug 21, 3:21pm, Richard Curnow wrote: } } On page 74, 2nd para from the end, } } It seems a bit odd to signal a process to restart; why can't the } operating system just restart it when you ask? The real answer is } probably that signals provide an easy way for you to talk to the } operating system without grovelling around in the dirt too much. } } I think it's to provide a way for a process to save and restore state } across the suspension, by installing handlers for SIGTSTP and SIGCONT. Saving and restoring state is one reason that there are four signals to stop a process (STOP, TSTP, TTIN, TTOU). However, it's not the reason that a signal is used for SIGCONT; Peter's more on target with that one. There's no such thing as a SIGCONT handler, by the way. The process just picks up where it left off (possibly with system calls interrupted depending on the operating system). A typical TSTP handler looks like save_state(); kill(getpid(), SIGSTOP); /* STOP is not catchable */ restore_state(); -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net