Fix pthread's empth_select() not to change the timeout
Commit 08b94556
introduced the timeout parameter. The empthread
implementation could change it, at least on some systems, and its user
worked around a possible change. However, that behavior was not
documented, and it's inconvenient. Fix the pthread implementation,
and remove the workaround.
This commit is contained in:
parent
6564ff2240
commit
6144a363d6
2 changed files with 8 additions and 4 deletions
|
@ -290,10 +290,11 @@ empth_terminate(empth_t *a)
|
|||
}
|
||||
|
||||
int
|
||||
empth_select(int fd, int flags, struct timeval *tv)
|
||||
empth_select(int fd, int flags, struct timeval *timeout)
|
||||
{
|
||||
fd_set readmask;
|
||||
fd_set writemask;
|
||||
struct timeval tv;
|
||||
int n;
|
||||
int res = 0;
|
||||
|
||||
|
@ -318,7 +319,11 @@ empth_select(int fd, int flags, struct timeval *tv)
|
|||
goto done;
|
||||
}
|
||||
|
||||
n = select(fd + 1, &readmask, &writemask, (fd_set *) 0, tv);
|
||||
if (timeout) {
|
||||
tv = *timeout;
|
||||
timeout = &tv;
|
||||
}
|
||||
n = select(fd + 1, &readmask, &writemask, NULL, timeout);
|
||||
|
||||
if (n < 0) {
|
||||
if (errno == EINTR) /* go handle the signal */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue