Solved

signal() and sigaction() ?

Posted on 2002-05-26
3
638 Views
Last Modified: 2010-05-18
Hi
Can anyone tell me the difference between signal and sigaction? I am having an alarm which interrupts a blocking recvfrom call every 10 seconds. When I used signal to specify the function to handle SIGALRM signal, the signal was handled but the recvfrom did not return after the alarm was processed.
When I used sigaction, recvfrom call was interrupted and after executing the signal handling function it proceded to the next line in my program. I thought both signal and sigaction could be used interchangably for
specifying the signal handling functions.
Thanks
Sreekumar.
0
Comment
Question by:sreekumarvk
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
ecw earned 100 total points
Comment Utility
BSD semantics - some sys calls are restartable if a signal is received during the call.  sigaction has a flag to enable this - SA_RESTART.  Set this and both your tests will do the same.  If you're were using SYSV semantics, your recvfrom would return an EINTR if you used signal, and an alarm was received.
0
 

Author Comment

by:sreekumarvk
Comment Utility
Hi ecw,
Thanks for the help.. Now things are more clear.
Sreekumar
0
 
LVL 5

Expert Comment

by:ecw
Comment Utility
No worries.  There a good description of signal handling in the comp.unix.programming faq.  It might apply to Linux too, although not everything is the same, the faq is a good place to start, see
  http://www.erlenstar.demon.co.uk/unix/faq_toc.html
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now