Unix Programming - About SIGCONT

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > March 2005 > About SIGCONT





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author About SIGCONT
LDD

2005-03-16, 6:02 pm

Hi all,


I'm asking this question just to be sure even if the man page should
have cleared it to me ...

I was told that a SIGCONT signal tells a process to go on with the
next instruction, meaning that it discards the current instruction and
go on with the next (!?)

But to me SIGCONT is just the counterpart of SIGSTOP (and others ... )
; it's telling the process to continue where it was stopped.

So the effect of such a signal on a process that is waiting on a
semaphore will not be to bypass the current instruction but to
unfreeze the process and go on waiting on the semaphore ... and this
whatever the unix platform

Loic
Pascal Bourguignon

2005-03-16, 6:02 pm

loicderoyand@yahoo.fr (LDD) writes:

> Hi all,
>
>
> I'm asking this question just to be sure even if the man page should
> have cleared it to me ...
>
> I was told that a SIGCONT signal tells a process to go on with the
> next instruction, meaning that it discards the current instruction and
> go on with the next (!?)
>
> But to me SIGCONT is just the counterpart of SIGSTOP (and others ... )
> ; it's telling the process to continue where it was stopped.
>
> So the effect of such a signal on a process that is waiting on a
> semaphore will not be to bypass the current instruction but to
> unfreeze the process and go on waiting on the semaphore ... and this
> whatever the unix platform


No. It's used with SIGSTOP, to manage jobs.

Try:

awk 'BEGIN{while(1){printf ".";for(i=0;i<1000000;i++){j=i*i;}}}' & pid=$! ;\
sleep 10 ; echo STOP ; kill -STOP $pid ;\
sleep 10 ; echo CONT ; kill -CONT $pid ;\
sleep 10 ; echo TERM ; kill -TERM $pid


Sending SIGCONT to a running process would be ignored normally.

--
__Pascal Bourguignon__ http://www.informatimago.com/

In a World without Walls and Fences,
who needs Windows and Gates?
Fletcher Glenn

2005-03-16, 8:47 pm

LDD wrote:
> Hi all,
>
>
> I'm asking this question just to be sure even if the man page should
> have cleared it to me ...
>
> I was told that a SIGCONT signal tells a process to go on with the
> next instruction, meaning that it discards the current instruction and
> go on with the next (!?)
>
> But to me SIGCONT is just the counterpart of SIGSTOP (and others ... )
> ; it's telling the process to continue where it was stopped.
>
> So the effect of such a signal on a process that is waiting on a
> semaphore will not be to bypass the current instruction but to
> unfreeze the process and go on waiting on the semaphore ... and this
> whatever the unix platform
>
> Loic


I implemented a program using curses. If you sent SIGTSTOP to the
process, it would catch this, do some screen cleanup and the raise SIGSTOP.

The SIGCONT handler would do some screen restore, and then the program
would resume executing.

If you just sent SIGSTOP to the process, it cannot catch this, and all
bets were off as to how sane your screen was.

--

Fletcher Glenn

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com