LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-03-2008, 03:12 PM   #1
wkhoo
LQ Newbie
 
Registered: Apr 2008
Posts: 16

Rep: Reputation: 0
Timers SIGRTMIN is causing Socket Read to error on EINTR


never used timers before and currently I am experiencing the problem.

I have setup timers to trap on a SIGRTMIN.
I have a blocking socket that does read_socket. whenever the timer expire, the read_socket will return with - and EINTR.

after much searching I discover the issue comes from a Blocking socket implementation.
I cannot change the socket to non-blocking as it will eat up the CPU.

Is there a different way I can implement timers?
or is there a way I can setup a blocking socket to prevent the return of EINTR?
 
Old 07-04-2008, 11:05 PM   #2
Alexlun
LQ Newbie
 
Registered: Apr 2008
Posts: 19

Rep: Reputation: 0
A better solution is continue to read socket when occurs some EINTR signal.

for example
while(1)
{
ret = read(sockfd...);
if ( ret < 0 && errno == EINTR ) continue;

//do other logic
}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot read data at server socket, though client socket sends it jacques83 Linux - Networking 0 11-15-2005 01:58 PM
Unable to connect to UNIX socket /tmp/.esd/socket error while using grip dr_zayus69 Linux - Software 4 08-23-2005 07:28 PM
strange - suddenly EINTR' undeclared polrus Linux - Software 3 04-23-2005 11:03 AM
C++ Socket: How to read a long maldini1010 Programming 3 02-25-2005 03:56 PM
read socket adoyee Programming 3 02-26-2004 06:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration