Re: work-around for EINTR error
- From: "Armel Asselin" <armelasselin@xxxxxxxxxxx>
- Date: Wed, 17 May 2006 14:04:35 +0200
i've seen somewhere that there is a way to have auto-restart for most of the
calls, I think I saw that in signal help
in devhelp in Debian, the chapter is called 'Signal handling'
there is a sigaction(..., SA_RESTART, ...) (with the ... being the right
stuff for you)
there is also a wrapper TEMP_FAILURE_RETRY but the sigaction stuff would be
probably more practical
WIH
Armel
<pvl_google@xxxxxxxxx> a écrit dans le message de news:
1147867032.314943.136180@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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: pvl_google@xxxxxxxxx
- Re: work-around for EINTR error
- References:
- work-around for EINTR error
- From: pvl_google@xxxxxxxxx
- work-around for EINTR error
- Prev by Date: Re: pthreads and waitpid
- Next by Date: compiled xpsread on Fedora Core 5
- Previous by thread: work-around for EINTR error
- Next by thread: Re: work-around for EINTR error
- Index(es):
Relevant Pages
|