how to suspend a process

Root Boy Jim rbj at uunet.UU.NET
Wed Feb 6 18:02:44 AEST 1991


In article <7016 at alpha.cam.nist.gov> coleman at cam.nist.gov (Sean Sheridan Coleman X5672) writes:
>In a program I am writing, I want to be able to catch SIGTSTP
>but if I do that, the process will not get suspended. How can
>I do what the shell would do under normal situation, suspend the
>process? Is sigsuspend the way to go? 

In your handler, you send yourself a SIGSTOP, which you cannot catch.
You could also unregister your handler, then send a SIGTSTP.

>How to I get my program to restart ...

Another process sends it a SIGCONT, most likely your shell as the
result of typing "fg" or "bg".

> ...or do I need to concern myself with this problem?

Well, yess and no. The tricky thing is figuring out what to do
before and after you're suspended. Typical things are:
save and restore tty modes, flush output files, repaint screen
after resuming. You will resume in your TSTP signal handler.

You may want to look at something like less to see what to do.

>Thanks
>
>Sean Coleman
>coleman at bldrdoc.gov

Are you in Boulder or Gaithersburg?
-- 

	Root Boy Jim Cottrell <rbj at uunet.uu.net>
	I got a head full of ideas
	They're driving me insane



More information about the Comp.unix.questions mailing list