Fixed waiting

This commit is contained in:
mainzelm 2002-02-19 08:58:12 +00:00
parent d77257ae6b
commit b5aa75894a
1 changed files with 12 additions and 6 deletions

View File

@ -623,7 +623,7 @@ queue_ready_ports(bool wait, long seconds, long ticks)
tv.tv_usec = 0; tv.tv_usec = 0;
} }
else { else {
tv.tv_sec = seconds; tv.tv_sec = (seconds > 0) ? 1 : 0;
tv.tv_usec = ticks * (1000000 / TICKS_PER_SECOND); tv.tv_usec = ticks * (1000000 / TICKS_PER_SECOND);
} }
else else
@ -648,12 +648,18 @@ queue_ready_ports(bool wait, long seconds, long ticks)
poll_time = -1; poll_time = -1;
return NO_ERRORS; return NO_ERRORS;
} }
else if (left == 0 && seconds == -1) else if (wait && (left == 0) && (limfd == 0)){
return NO_ERRORS; if (seconds > 1){
else if (left == 0 && seconds > 0){ seconds--;
tv.tv_sec = --seconds; tv.tv_sec = 1; /* select maybe destroyed tv */
tv.tv_usec = 0; /* we already waited the usecs */
}
else if (seconds > -1) return NO_ERRORS;
else { /* loop if seconds == -1 */
tv.tv_sec = 1;
tv.tv_usec = 0; tv.tv_usec = 0;
} }
}
else if (left == 0) else if (left == 0)
return NO_ERRORS; return NO_ERRORS;
else if (errno == EINTR) { else if (errno == EINTR) {