diff options
author | deischen <deischen@FreeBSD.org> | 1999-08-12 19:34:39 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 1999-08-12 19:34:39 +0000 |
commit | 0fdfbcb26fcbbbc9307c76219303fa31833e0d4a (patch) | |
tree | 00a8e2a71818d0eef07f0156f42401c3d0e6b46e /lib/libpthread | |
parent | 97c2576051eae8d800ad2b6dcc254c6a028c98a2 (diff) | |
download | FreeBSD-src-0fdfbcb26fcbbbc9307c76219303fa31833e0d4a.zip FreeBSD-src-0fdfbcb26fcbbbc9307c76219303fa31833e0d4a.tar.gz |
Add check for runnable threads before polling file descriptors.
Submitted by: tegge
Diffstat (limited to 'lib/libpthread')
-rw-r--r-- | lib/libpthread/thread/thr_kern.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c index 8718906..e30267b 100644 --- a/lib/libpthread/thread/thr_kern.c +++ b/lib/libpthread/thread/thr_kern.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uthread_kern.c,v 1.16 1999/03/23 05:07:56 jb Exp $ + * $Id: uthread_kern.c,v 1.19 1999/06/20 08:28:31 jb Exp $ * */ #include <errno.h> @@ -679,27 +679,24 @@ _thread_kern_poll(int wait_reqd) /* * Check to see if the signal queue needs to be walked to look - * for threads awoken by a signal while in the scheduler. Only - * do this if a wait is specified; otherwise, the waiting queue - * will be checked after the zero-timed _poll. + * for threads awoken by a signal while in the scheduler. */ - while ((_sigq_check_reqd != 0) && (timeout_ms != 0)) { + if (_sigq_check_reqd != 0) { /* Reset flag before handling queued signals: */ _sigq_check_reqd = 0; dequeue_signals(); + } + /* + * Check for a thread that became runnable due to a signal: + */ + if (PTHREAD_PRIOQ_FIRST() != NULL) { /* - * Check for a thread that became runnable due to - * a signal: + * Since there is at least one runnable thread, + * disable the wait. */ - if (PTHREAD_PRIOQ_FIRST() != NULL) { - /* - * Since there is at least one runnable thread, - * disable the wait. - */ - timeout_ms = 0; - } + timeout_ms = 0; } /* @@ -729,6 +726,11 @@ _thread_kern_poll(int wait_reqd) PTHREAD_WAITQ_SETACTIVE(); /* One less thread in a spinblock state: */ _spinblock_count--; + /* + * Since there is at least one runnable + * thread, disable the wait. + */ + timeout_ms = 0; } break; |