Fixed waiting
This commit is contained in:
parent
d77257ae6b
commit
b5aa75894a
|
@ -623,7 +623,7 @@ queue_ready_ports(bool wait, long seconds, long ticks)
|
|||
tv.tv_usec = 0;
|
||||
}
|
||||
else {
|
||||
tv.tv_sec = seconds;
|
||||
tv.tv_sec = (seconds > 0) ? 1 : 0;
|
||||
tv.tv_usec = ticks * (1000000 / TICKS_PER_SECOND);
|
||||
}
|
||||
else
|
||||
|
@ -648,12 +648,18 @@ queue_ready_ports(bool wait, long seconds, long ticks)
|
|||
poll_time = -1;
|
||||
return NO_ERRORS;
|
||||
}
|
||||
else if (left == 0 && seconds == -1)
|
||||
return NO_ERRORS;
|
||||
else if (left == 0 && seconds > 0){
|
||||
tv.tv_sec = --seconds;
|
||||
else if (wait && (left == 0) && (limfd == 0)){
|
||||
if (seconds > 1){
|
||||
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;
|
||||
}
|
||||
}
|
||||
else if (left == 0)
|
||||
return NO_ERRORS;
|
||||
else if (errno == EINTR) {
|
||||
|
|
Loading…
Reference in New Issue