summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
diff options
context:
space:
mode:
authorarchie <archie@FreeBSD.org>2002-08-29 00:44:11 +0000
committerarchie <archie@FreeBSD.org>2002-08-29 00:44:11 +0000
commit18b0669383969e956ef080c81d22cc5762848da0 (patch)
tree469c29a146f1d99cc3c272852cc2252ff3475d5f /lib/libpthread
parent3177d246be6fe17cfcbc545dbde8ebd2b515dc47 (diff)
downloadFreeBSD-src-18b0669383969e956ef080c81d22cc5762848da0.zip
FreeBSD-src-18b0669383969e956ef080c81d22cc5762848da0.tar.gz
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
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/thread/thr_kern.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c
index 2bd855c..55296eb 100644
--- a/lib/libpthread/thread/thr_kern.c
+++ b/lib/libpthread/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);
OpenPOWER on IntegriCloud