Solved

signal() and sigaction() ?

Posted on 2002-05-26
3
680 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

728 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