diff options
| author | David Xu <davidxu@FreeBSD.org> | 2004-10-08 22:57:30 +0000 |
|---|---|---|
| committer | David Xu <davidxu@FreeBSD.org> | 2004-10-08 22:57:30 +0000 |
| commit | 42c7735ce5d0e92ec65ec5c745c2e0490143b00f (patch) | |
| tree | 46b6ad6f16177e41e96b19c3d0c7b21a013c7793 /lib/libpthread/thread | |
| parent | 39e6971cba818b476ded579b3582f0d2dc1c3176 (diff) | |
Notes
Diffstat (limited to 'lib/libpthread/thread')
| -rw-r--r-- | lib/libpthread/thread/thr_kern.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c index 417e4b841f0d..6e0003a34de8 100644 --- a/lib/libpthread/thread/thr_kern.c +++ b/lib/libpthread/thread/thr_kern.c @@ -873,12 +873,14 @@ kse_sched_single(struct kse_mailbox *kmbx) THR_DEACTIVATE_LAST_LOCK(curthread); kse_wait(curkse, curthread, sigseqno); THR_ACTIVATE_LAST_LOCK(curthread); - KSE_GET_TOD(curkse, &ts); - if (thr_timedout(curthread, &ts)) { - /* Indicate the thread timedout: */ - curthread->timeout = 1; - /* Make the thread runnable. */ - THR_SET_STATE(curthread, PS_RUNNING); + if (curthread->wakeup_time.tv_sec >= 0) { + KSE_GET_TOD(curkse, &ts); + if (thr_timedout(curthread, &ts)) { + /* Indicate the thread timedout: */ + curthread->timeout = 1; + /* Make the thread runnable. */ + THR_SET_STATE(curthread, PS_RUNNING); + } } } @@ -1811,13 +1813,12 @@ kse_wait(struct kse *kse, struct pthread *td_wait, int sigseqno) struct timespec ts, ts_sleep; int saved_flags; - KSE_GET_TOD(kse, &ts); - if ((td_wait == NULL) || (td_wait->wakeup_time.tv_sec < 0)) { /* Limit sleep to no more than 1 minute. */ ts_sleep.tv_sec = 60; ts_sleep.tv_nsec = 0; } else { + KSE_GET_TOD(kse, &ts); TIMESPEC_SUB(&ts_sleep, &td_wait->wakeup_time, &ts); if (ts_sleep.tv_sec > 60) { ts_sleep.tv_sec = 60; |
