Solved

SIGALRM doesn't interrupt gets()?

Posted on 1997-07-21
1
246 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

729 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