re-posting question from comp.unix.programmer
- From: Chad <cdalten@xxxxxxxxx>
- Date: 28 May 2007 12:07:12 -0700
I'm not too sure if the lack of response was to due
1)The regulars are fed up with me
2)The regulars are too obsessed with the large file thread
3)The question I'm asking is poorly worded.
Lately I've started to look at the source to to some larger *nix
programs. Anyhow, I'm finding out that I'm struggling to understand
the parts that I can make sense out of -(.
Okay, with that, below is the function and comment
in wrt_sig.c
RETSIGTYPE intr(int sig)
{
if (insys && (sig == SIGINT))
{
signal (SIGINT, (RETSIGTYPE (*)())intr);
longjmp(sysenv,1);
}
done(1);
}
/* SUSP -- Suspend the process. Unlike shell escapes, we restore the
wrttmp
* entry before stopping. This is because, unlike shell escapes, we
can't
* assume that stopped processes will be restarted in the reverse
order in
* which they were stopped.
*/
#ifdef JOB_CONTROL
RETSIGTYPE susp()
{
int was_cbreak= in_cbreak;
int mask;
/* Disable further signals */
mask= sigblock(sigmask(SIGTSTP));
/* Restore modes and make wrttmp look like we exited */
if (in_cbreak) cbreak(FALSE);
if (postpone) show_lastmesg();
reset_modes();
signal(SIGTSTP,SIG_DFL);
sigsetmask(0);
kill(getpid(),SIGTSTP);
/* STOP HERE */
sigsetmask(mask);
signal(SIGTSTP,(RETSIGTYPE (*)())susp);
/* Reinstate cbreak mode and wrttmp entry */
if (was_cbreak) cbreak(TRUE);
update_modes();
if (!telegram) set_modes();
}
#endif /*JOB_CONTROL*/
I don't get what the author means by
"This is because, unlike shell escapes, we can't
* assume that stopped processes will be restarted in the reverse
order in
* which they were stopped."
I guess I don't get the significance of starting a process in reverse
order.
.
- Follow-Ups:
- Re: re-posting question from comp.unix.programmer
- From: Pascal Bourguignon
- Re: re-posting question from comp.unix.programmer
- Prev by Date: Re: Schools working to overhaul the art of computer programming (The Columbian)
- Next by Date: Re: Schools working to overhaul the art of computer programming (The Columbian)
- Previous by thread: pop up... ;(
- Next by thread: Re: re-posting question from comp.unix.programmer
- Index(es):