pause() and raise()
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > pause() and raise()




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    pause() and raise()  
Josh Birnbaum


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-30-05 07:49 AM

Hi Folks,

I have a daemon code that, after initialization and the installation of
signal handlers (via sigset(2)), enters a for(;;) loop and calls
pause(2).

I'm sending SIGUSR1 and SIGUSR2, via kill() (eg. % kill -16
<daemon_pid> ),
to the daemon to invoke code triggered by the reception of these 2
signals.
What I would also like to do is to use raise(3C) to have the daemon send
SIGUSR1 and SIGUSR2 to itself at a user defined interval, thus invoking
the above code.

Code invocation via pause(2) or raise(3C) has to be separate (ie. I
cannot
call raise(3C) from within the for(;;) loop containing the pause(2)
call.
Nor can I call raise(3C) from within any code executed as a result of a
call from out of pause(2).
The thing is that in the current scenario, the raise(3C) calls will
never
be executed.

I'm working on this locally but I also wanted to put this to the group
to see if anyone had any feedback on the above.

Thanks,

Josh.





[ Post a follow-up to this message ]



    Re: pause() and raise()  
Maxim Yegorushkin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-30-05 07:49 AM

Josh Birnbaum wrote:
> Hi Folks,
>
> I have a daemon code that, after initialization and the installation of
> signal handlers (via sigset(2)), enters a for(;;) loop and calls
> pause(2).
>
> I'm sending SIGUSR1 and SIGUSR2, via kill() (eg. % kill -16
> <daemon_pid> ),
> to the daemon to invoke code triggered by the reception of these 2
> signals.
> What I would also like to do is to use raise(3C) to have the daemon send
> SIGUSR1 and SIGUSR2 to itself at a user defined interval, thus invoking
> the above code.
>
> Code invocation via pause(2) or raise(3C) has to be separate (ie. I
> cannot
> call raise(3C) from within the for(;;) loop containing the pause(2)
> call.
> Nor can I call raise(3C) from within any code executed as a result of a
> call from out of pause(2).
> The thing is that in the current scenario, the raise(3C) calls will
> never
> be executed.

Why can't you call raise() and what do you use pause() for? This all
sounds odd.

Can't you just process signals synchronously using sigtimedwait?






[ Post a follow-up to this message ]



    Re: pause() and raise()  
moi


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-30-05 12:48 PM

Maxim Yegorushkin wrote:
> Josh Birnbaum wrote:
> 
>
>
> Why can't you call raise() and what do you use pause() for? This all
> sounds odd.
>
> Can't you just process signals synchronously using sigtimedwait?
>

Silly, indeed.
How about setting an alarm ? It would make the pause() return,
or you could even make the alarm signalhandler send signals to self.
Even more silly, I agree. Replacing the pause() by a sleep() like
systemcall would basically do what you want a lot easyer.

HTH,
AvK





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:05 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register