oops, forgot !
This commit is contained in:
parent
63e070c1cb
commit
f2d8be239f
@ -10,7 +10,7 @@ int64 io_tryreadtimeout(int64 d,char* buf,int64 len) {
|
|||||||
tai6464 x;
|
tai6464 x;
|
||||||
io_entry* e=array_get(&io_fds,sizeof(io_entry),d);
|
io_entry* e=array_get(&io_fds,sizeof(io_entry),d);
|
||||||
taia_now(&x);
|
taia_now(&x);
|
||||||
if (taia_less(&x,&e->timeout)) {
|
if (!taia_less(&x,&e->timeout)) {
|
||||||
errno=ETIMEDOUT;
|
errno=ETIMEDOUT;
|
||||||
r=-2;
|
r=-2;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ int64 io_trywritetimeout(int64 d,const char* buf,int64 len) {
|
|||||||
tai6464 x;
|
tai6464 x;
|
||||||
io_entry* e=array_get(&io_fds,sizeof(io_entry),d);
|
io_entry* e=array_get(&io_fds,sizeof(io_entry),d);
|
||||||
taia_now(&x);
|
taia_now(&x);
|
||||||
if (taia_less(&x,&e->timeout)) {
|
if (!taia_less(&x,&e->timeout)) {
|
||||||
errno=ETIMEDOUT;
|
errno=ETIMEDOUT;
|
||||||
r=-2;
|
r=-2;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ main() {
|
|||||||
taia_addsec(&t,&t,1);
|
taia_addsec(&t,&t,1);
|
||||||
if (!io_fd(pfd[0])) return 111;
|
if (!io_fd(pfd[0])) return 111;
|
||||||
io_timeout(pfd[0],t);
|
io_timeout(pfd[0],t);
|
||||||
|
sleep(2);
|
||||||
if ((r=io_tryreadtimeout(pfd[0],buf,sizeof buf))!=-2) {
|
if ((r=io_tryreadtimeout(pfd[0],buf,sizeof buf))!=-2) {
|
||||||
buffer_puts(buffer_2,"io_tryreadtimeout returned ");
|
buffer_puts(buffer_2,"io_tryreadtimeout returned ");
|
||||||
buffer_putlonglong(buffer_2,r);
|
buffer_putlonglong(buffer_2,r);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user