fix Solaris /dev/poll

master
leitner 21 years ago
parent 65adb024f5
commit a4cf7a8a8b

@ -47,6 +47,7 @@ void io_dontwantread(int64 d) {
x.fd=d; x.fd=d;
x.events=0; x.events=0;
if (e->wantwrite) x.events|=POLLOUT; if (e->wantwrite) x.events|=POLLOUT;
if (!x.events) x.events=POLLREMOVE;
write(io_master,&x,sizeof(x)); write(io_master,&x,sizeof(x));
} }
#endif #endif

@ -47,6 +47,7 @@ void io_dontwantwrite(int64 d) {
x.fd=d; x.fd=d;
x.events=0; x.events=0;
if (e->wantread) x.events|=POLLIN; if (e->wantread) x.events|=POLLIN;
if (!x.events) x.events=POLLREMOVE;
write(io_master,&x,sizeof(x)); write(io_master,&x,sizeof(x));
} }
#endif #endif

@ -103,16 +103,20 @@ int64 io_waituntil2(int64 milliseconds) {
} }
if (!e->canread && (y[n].revents&POLLIN)) { if (!e->canread && (y[n].revents&POLLIN)) {
e->canread=1; e->canread=1;
if (e->next_read==-1) {
e->next_read=first_readable; e->next_read=first_readable;
first_readable=y[n].fd; first_readable=y[n].fd;
} }
}
if (!e->canwrite && (y[n].revents&POLLOUT)) { if (!e->canwrite && (y[n].revents&POLLOUT)) {
e->canwrite=1; e->canwrite=1;
if (e->next_write==-1) {
e->next_write=first_writeable; e->next_write=first_writeable;
first_writeable=y[i].fd; first_writeable=y[i].fd;
} }
} }
} }
}
return n; return n;
} }
#endif #endif

Loading…
Cancel
Save