Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

signal() and sigaction() ?

Posted on 2002-05-26
3
Medium Priority
?
703 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
ecw earned 400 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
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…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

610 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