[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lib_twait.c
From: |
Philippe Blain |
Subject: |
lib_twait.c |
Date: |
Tue, 6 Aug 2002 06:22:29 +0200 |
>From Philippe Blain, Bordeaux, FRANCE - <address@hidden>
My very old computer: P133 - 8,4 Go - 32 Mo Red Hat Linux 7.0
I have a dream (P-IV 40Go Geforce4 flat screen...)
To maintainers of 'ncurses'.(and to Mr Dickey)
Subject: Corrections for ncurses-5.2-20020803+
Here are some problems I found:
----------------------------------------------------------------------------
----
Thanks for your response about lib_getch.c. I'm going to investigate more
about
that if I can.
----------------------------------------------------------------------------
----
File : ncurses/tty/lib_twait.c
Function : _nc_timed_wait(int mode, int milliseconds, int *timeleft)
OK, infinite timeout seems good now.
Just a little remark:
The code makes no difference between returning an error
because functions have failed (poll, select or ioctl) and when no file
descriptors have changed status.
The return value is 0 in both cases.
It's possible to return (-1) when functions fail by just modifying the end
or forcing "if (result==-1) return(-1);" just after poll, select or ioctl.
All possible returns values would be :
0 - no activity
1 - datas on input descriptor
2 - mouse activity
3 - activity on input and mouse
(-1) - Error, errno is set.
And then testing as "if (_nc_timed_wait(...) > 0)" in lib_getch.c,
lib_mouse.c.
This would permit to test errno==EINTR in the mouse code for lib_getch.c
..........
#if USE_GPM_SUPPORT || defined(USE_EMX_MOUSE)
/* Infinite timeout, waiting for mouse or key */
if ((SP->_mouse_fd >= 0)
==> && ((n = _nc_timed_wait(3, -1, (int *) 0)) & 2)) {
/* Prefer mouse activity first*/
SP->_mouse_event(SP);
ch = KEY_MOUSE;
} else
#endif
{
/* else keyboard activity */
unsigned char c2 = 0;
n = read(SP->_ifd, &c2, 1);
ch = c2;
}
#ifdef HIDE_EINTR
/* Interrupted by a non-restarting signal */
/* Now, as n==-1 because _nc_timed_wait failed, goto again */
if (n <= 0 && errno == EINTR)
goto again;
#endif
..........
----------------------------------------------------------------------------
----
- Philippe
- lib_twait.c,
Philippe Blain <=