From 18b0669383969e956ef080c81d22cc5762848da0 Mon Sep 17 00:00:00 2001 From: archie Date: Thu, 29 Aug 2002 00:44:11 +0000 Subject: When poll(2)'ing for readability or writability of a file descriptor on behalf of a thread, we should check the POLLERR, POLLHUP, and POLLNVAL flags as well to wake up the thread in these cases. Suggested by: deischen MFC after: 3 days --- lib/libkse/thread/thr_kern.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/libkse') diff --git a/lib/libkse/thread/thr_kern.c b/lib/libkse/thread/thr_kern.c index 2bd855c..55296eb 100644 --- a/lib/libkse/thread/thr_kern.c +++ b/lib/libkse/thread/thr_kern.c @@ -880,7 +880,9 @@ thread_kern_poll(int wait_reqd) /* File descriptor read wait: */ case PS_FDR_WAIT: if ((nfds < _thread_dtablesize) && - (_thread_pfd_table[nfds].revents & POLLRDNORM)) { + (_thread_pfd_table[nfds].revents + & (POLLRDNORM|POLLERR|POLLHUP|POLLNVAL)) + != 0) { PTHREAD_WAITQ_CLEARACTIVE(); PTHREAD_WORKQ_REMOVE(pthread); PTHREAD_NEW_STATE(pthread,PS_RUNNING); @@ -892,7 +894,9 @@ thread_kern_poll(int wait_reqd) /* File descriptor write wait: */ case PS_FDW_WAIT: if ((nfds < _thread_dtablesize) && - (_thread_pfd_table[nfds].revents & POLLWRNORM)) { + (_thread_pfd_table[nfds].revents + & (POLLWRNORM|POLLERR|POLLHUP|POLLNVAL)) + != 0) { PTHREAD_WAITQ_CLEARACTIVE(); PTHREAD_WORKQ_REMOVE(pthread); PTHREAD_NEW_STATE(pthread,PS_RUNNING); -- cgit v1.1