Browse Source

make io_waituntil actually take an "until", not a "how long"

fix io_timeouted to ignore fds where no timeout has been set
master
Felix von Leitner 17 years ago
parent
commit
7497685b8b
3 changed files with 7 additions and 4 deletions
  1. +1
    -0
      CHANGES
  2. +3
    -2
      io/io_timeouted.c
  3. +3
    -2
      io/io_waituntil.c

+ 1
- 0
CHANGES View File

@ -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)


+ 3
- 2
io/io_timeouted.c View File

@ -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;
}

+ 3
- 2
io/io_waituntil.c View File

@ -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…
Cancel
Save