make io_waituntil actually take an "until", not a "how long"
fix io_timeouted to ignore fds where no timeout has been set
This commit is contained in:
parent
3279ca84f8
commit
97043d279f
1
CHANGES
1
CHANGES
@ -5,6 +5,7 @@
|
||||
the integer scan routines should only write *dest if they actually
|
||||
scanned something
|
||||
io_sendfile and iob_send should return -1 to -3 just like io_trywrite
|
||||
make io_waituntil actually take an "until", not a "how long"
|
||||
|
||||
0.16:
|
||||
add buffer_fromsa (make buffer from stralloc)
|
||||
|
@ -10,8 +10,9 @@ int64 io_timeouted() {
|
||||
if (ptr>=alen) ptr=0;
|
||||
e=array_get(&io_fds,sizeof(io_entry),ptr);
|
||||
if (!e) return -1;
|
||||
for (;ptr<alen; ++ptr,++e)
|
||||
if (e->inuse && taia_less(&e->timeout,&now))
|
||||
for (;ptr<alen; ++ptr,++e) {
|
||||
if (e->inuse && e->timeout.sec.x && taia_less(&e->timeout,&now))
|
||||
return ptr;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -7,9 +7,10 @@
|
||||
|
||||
void io_waituntil(tai6464 t) {
|
||||
uint64 x,y;
|
||||
tai6464 now;
|
||||
tai6464 now,diff;
|
||||
taia_now(&now);
|
||||
if (!umult64(now.sec.x,1000,&x) || (y=x+now.nano/10000000)<x)
|
||||
taia_sub(&diff,&t,&now);
|
||||
if (!umult64(diff.sec.x,1000,&x) || (y=x+diff.nano/10000000)<x)
|
||||
y=-1; /* overflow; wait indefinitely */
|
||||
io_waituntil2(y);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user