[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Behaviour of wgetch during Signal Handling (EINTR)
From: |
Leon Winter |
Subject: |
Behaviour of wgetch during Signal Handling (EINTR) |
Date: |
Wed, 24 Aug 2016 10:11:40 +0200 |
User-agent: |
Mutt/1.6.2-neo (2016-07-23) |
Hi,
we currently use ncurses-6.0+20160625.
The man page of wgetch claims:
Programmers concerned about portability should be prepared for either
of two cases: (a) signal receipt does not interrupt getch; (b) signal
receipt interrupts getch and causes it to return ERR with errno set to
EINTR. Under the ncurses implementation, handled signals never inter-
rupt getch.
The most interesting sentence in the last one.
However in my application I am now seing this (trace):
end twait: returned -1 (4), remaining time 549253 msec
The wgetch function returns with ERR on that occasion. So it seems the man page
is wrong. I checked the source code as well and could not identify any loop for
EINTR which would justify claiming that the function would never be interrupted.
In my specific use case, I have a child process terminating at the time I am
waiting for user input in wgetch (). There is a signal handler installed for
SIGCHLD (which is called) but ncurses does not seem to handle EINTR in their
select loop.
Should the man page be fixed to reflect the actual behaviour or should the code
be changed?
Best regards,
Leon
- Behaviour of wgetch during Signal Handling (EINTR),
Leon Winter <=