[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Corrections for 20031122
From: |
Philippe Blain |
Subject: |
Corrections for 20031122 |
Date: |
Fri, 28 Nov 2003 20:39:26 +0100 |
>From Philippe Blain, Bordeaux, France.
My computer: P133 - 8,4 Go - 32 Mo Red Hat Linux 7.0
Corrections for ncurses-5.3-20031122+
1-----------------------------------------------------------------------
File : ncurses/tty/lib_twait.c
_nc_gettime() need some corrections to give a good value when subtracting:
static long _nc_gettime (bool first)
{
long res;
#if HAVE_GETTIMEOFDAY
# define PRECISE_GETTIME 1
static struct timeval t0;
struct timeval t1;
gettimeofday (&t1, (struct timezone *) 0);
if (first) {
t0 = t1;
==> res = 0; /* Useless to compute, result will be 0 */
}
else {
/* Prevent having a negative microsec diff */
==> if (t0.tv_usec > t1.tv_usec) { /* Convert 1s in 1e6 microsecs */
==> t1.tv_usec += 1000000;
==> t1.tv_sec--;
}
res = (t1.tv_sec - t0.tv_sec) * 1000 + (t1.tv_usec - t0.tv_usec) /
1000;
}
#else
...................
return res;
}
2-----------------------------------------------------------------------
File : ncurses/tinfo/lib_napms.c
nanosleep() can be interrupted by a signal. See nanosleep(2).
Modifs proposed :
NCURSES_EXPORT (int) napms (int ms)
{
T ((T_CALLED ("napms(%d)"), ms));
#if HAVE_NANOSLEEP
{
==> struct timespec request, remaining;
==> int err;
==> request.tv_sec = ms / 1000;
==> request.tv_nsec = (ms % 1000) * 1000000;
==> while ((err = nanosleep (&request, &remaining)) == -1
==> && errno == EINTR)
==> request = remaining;
}
#else
...................
#endif
returnCode(OK);
}
NOTE :
* Interaction between EINTR and non-restarting of system calls interrupted
by
signals ? (see lib_tstp.c comments).
It seems that HIDE_EINTR is used (lib_getch.c) but never defined
(configure).
[searching in the library with a grep -r]
* Recursion problems between napms() and _nc_timed_wait() when not
having nanosleep().
------------------------------------------------------------------------
- Philippe
- Corrections for 20031122,
Philippe Blain <=