work-around for EINTR error
- From: "pvl_google@xxxxxxxxx" <pvl_google@xxxxxxxxx>
- Date: 17 May 2006 04:57:12 -0700
Hi,
We're porting a multithreaded application to Linux using the NPTL
pthreads library, and using gdb/eclipse for debugging. When gdb wants
to stop the application (breakpoints and single stepping), it sends a
SIGSTOP to all threads within the process.
Reading the manpages, I found that a lot of system + std libary calls
may be interrupted by this (and other) signals and return with EINTR.
Apparently it's up to the user to explicitly "restart" such calls,
taking into account extra difficulties for some:
- sleeps must be restarted with remaining time
- writes must be restarted with the remaining number of bytes
- (f)printf can be interrupted in the midst of printing output
- (f)scanf can be interrupted while reading input
I find it at least cumbersome to implement such behaviour at
application level (is there any reason why one would not want to
restart the call ?). And it's also a risk, because there are really a
lot of calls which may be interrupted and it's easy to overlook one,
possibly yielding sporadic erroneous behavior.
Now I wonder whether there is a standard work-around for this problem,
like:
- some setting or hack to avoid call interruption
- a glibc version/patch that automatically restart calls
- a reference "wrapper" doing the restart
- any other...
Thanks,
Pieter
.
- Follow-Ups:
- Re: work-around for EINTR error
- From: Armel Asselin
- Re: work-around for EINTR error
- Prev by Date: pclose vs. fclose
- Next by Date: Re: pthreads and waitpid
- Previous by thread: pclose vs. fclose
- Next by thread: Re: work-around for EINTR error
- Index(es):
Relevant Pages
|
|