EINTR is a POSIX error code indicating that a system call was interrupted by a signal. Consider using this tag alongside more popular tags such as [signals] or [posix] for questions about this error.
Questions tagged [eintr]
27 questions
1
vote
0 answers
TEMP_FAILURE_RETRY and nonblocking sockets
Should I use TEMP_FAILURE_RETRY to surround library calls (which can fail and set errno to EINTR) on nonblocking sockets?

Lorenzo Pistone
- 5,028
- 3
- 34
- 65
1
vote
0 answers
Should I retry system calls that fail because of EINTR?
I have seen code like this:
again:
if ((n = read(fd, buf, BUFFSIZE)) < 0) {
if (errno == EINTR)
goto again; /* just an interrupted system call */
/* handle other errors */
}
The idea is to retry a system call…

user16217248
- 3,119
- 19
- 19
- 37
1
vote
1 answer
Is sem_timedwait with EINTR-check guaranteed to wait >= the specified time?
An oft-recommended approach to timed-waiting on a semaphore is (simplified for brevity):
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_sec += 5;
ts.tv_nsec += 3;
while (sem_timedwait(&sem, &ts) == -1 && errno == EINTR)
…

StoneThrow
- 5,314
- 4
- 44
- 86
1
vote
2 answers
I want to know which a signal is arrived when system call() is interrupted
My application has two threads. Each threads recevive some data from the server via each sockets. Threads wait to return epoll_wait(). Sometimes epoll_wait() returns -1 and errno is EINTR. EINTR means that system call() is interrupted by a signal. I…

user244620
- 11
- 3
0
votes
1 answer
pgloader: Socket error in "connect": EINTR (Interrupted system call) and HEAP-EXHAUSTED-ERROR
These days, I try to migrate data from mysql to postgres using pgloader. I encountered HEAP-EXHAUSTED-ERROR and Socket error.
For HEAP-EXHAUSTED-ERROR, I have tried to reduce the batch size and workers, but it didn't work.
For EINTR (Interrupted…

Frank
- 83
- 8
0
votes
0 answers
signal handler does not work within a thread
I cannot understand why, in the following program, when a SIGINT signal arrives, the thread terminates directly (even if not covered by the signal handler). However, this does not happen in the main() process.
Signal handler:
volatile sig_atomic_t…

QenBau
- 157
- 5
- 15
0
votes
1 answer
Proper way of handling SIGCHLD, EINT, and accept() in Linux
I have a program that creates a TCP server. When the accept() connects to a client, I fork() it and handle the connection. When that client leaves it calls the waitpid() because of the SIGCHLD, but this causes a EINTR in the accept(). My question…

Rich G.
- 61
- 1
- 1
- 5
0
votes
1 answer
How to manage reads with signals in C?
I'm reading integers from a file in this way:
int v, num;
for(;;) {
v = read(fd, &num, sizeof(int));
if (v == -1) {
fprintf(stderr, "Error in read()\n");
exit(EXIT_FAILURE);
}
if (v == 0)
…

cxsp
- 1
0
votes
1 answer
scanf function and EINTR signal
I am working on Linux platform.
I have a console based multi-threaded application which loads a multi-threaded shared object library for other functionalities.
The shared object library internally opens a serial port for communication.
The library…

Pratham
- 1
0
votes
2 answers
Socket Read In Multi-Threaded Application Returns Zero Bytes or EINTR (104)
Am a c-coder for a while now - neither a newbie nor an expert. Now, I have a certain daemoned application in C on a PPC Linux. I use PHP's socket_connect as a client to connect to this service locally. The server uses epoll for multiplexing…

EdNdee
- 745
- 1
- 10
- 18
0
votes
1 answer
standard C++ TCP socket, connect fails with EINTR when using std::async
I am having trouble using the std::async to have tasks execute in parallel when the task involves a socket.
My program is a simple TCP socket server written in standard C++ for Linux. When a client connects, a dedicated port is opened and separate…

Graham Briggs
- 1
- 6
0
votes
2 answers
Is there any method to wait until task catch SIGALRM signal in intel arch?
I'm programming iwth gcc version 4.4.3 on Ubuntu 10.04
I don't know how to catch SIGALRM with sigtimedwait(),sigwait().
If timer handler is set , sigtimedwait(),sigwait() always returns EINTR(4).
If timer handler is not set, SIGALRM never…

Boblishus
- 87
- 1
- 7