From a4cf7a8a8ba53d1d712a8f749710325860c21a26 Mon Sep 17 00:00:00 2001 From: leitner Date: Thu, 6 Nov 2003 21:08:30 +0000 Subject: [PATCH] fix Solaris /dev/poll --- io/io_dontwantread.c | 1 + io/io_dontwantwrite.c | 1 + io/io_waituntil2.c | 12 ++++++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/io/io_dontwantread.c b/io/io_dontwantread.c index 5fa4b33..52cb4a3 100644 --- a/io/io_dontwantread.c +++ b/io/io_dontwantread.c @@ -47,6 +47,7 @@ void io_dontwantread(int64 d) { x.fd=d; x.events=0; if (e->wantwrite) x.events|=POLLOUT; + if (!x.events) x.events=POLLREMOVE; write(io_master,&x,sizeof(x)); } #endif diff --git a/io/io_dontwantwrite.c b/io/io_dontwantwrite.c index 2122e51..fd5b477 100644 --- a/io/io_dontwantwrite.c +++ b/io/io_dontwantwrite.c @@ -47,6 +47,7 @@ void io_dontwantwrite(int64 d) { x.fd=d; x.events=0; if (e->wantread) x.events|=POLLIN; + if (!x.events) x.events=POLLREMOVE; write(io_master,&x,sizeof(x)); } #endif diff --git a/io/io_waituntil2.c b/io/io_waituntil2.c index 86d8f7d..8d51ce6 100644 --- a/io/io_waituntil2.c +++ b/io/io_waituntil2.c @@ -103,13 +103,17 @@ int64 io_waituntil2(int64 milliseconds) { } if (!e->canread && (y[n].revents&POLLIN)) { e->canread=1; - e->next_read=first_readable; - first_readable=y[n].fd; + if (e->next_read==-1) { + e->next_read=first_readable; + first_readable=y[n].fd; + } } if (!e->canwrite && (y[n].revents&POLLOUT)) { e->canwrite=1; - e->next_write=first_writeable; - first_writeable=y[i].fd; + if (e->next_write==-1) { + e->next_write=first_writeable; + first_writeable=y[i].fd; + } } } }