Solved

signal() and sigaction() ?

Posted on 2002-05-26
3
654 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
ID: 7036600
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
ID: 7037373
Hi ecw,
Thanks for the help.. Now things are more clear.
Sreekumar
0
 
LVL 5

Expert Comment

by:ecw
ID: 7037871
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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