Solved

SIGALRM doesn't interrupt gets()?

Posted on 1997-07-21
1
240 Views
Last Modified: 2013-12-26
I supposed that system calls such gets(), getc() should be interrupted by SIGALRM. And it seems to be true under Unixware 2.01, but it doesn't work under Linux. Why? What should I use to implement timed read?
0
Comment
Question by:boa
[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
1 Comment
 
LVL 4

Accepted Solution

by:
jos010697 earned 200 total points
ID: 1294019
You're halfway there; the default behavior of 'read' is to
restart after it has been interrupted by a signal _and_ if
nothing has been read just before the signal was raised.
BTW, gets() or getc() aren't system calls; it's the 'read'
call underneath that does all the work.

Check out the sigaction() call; it tells the signal handlers
_not_ to restart certain interrupted system calls ('read' is
one of them), by resetting the SA_RESTART bit ...

kind regards,

Jos aka jos@and.nl
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

740 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