diff options
| author | Daniel Eischen <deischen@FreeBSD.org> | 2006-03-16 23:29:08 +0000 |
|---|---|---|
| committer | Daniel Eischen <deischen@FreeBSD.org> | 2006-03-16 23:29:08 +0000 |
| commit | 40837c5215e9e4c23b101a3189cd6c208d173e0c (patch) | |
| tree | c75d029b3ed017e1bfce1ad3480052519a6e8f36 /lib/libpthread/thread/thr_mutex.c | |
| parent | 0683a54a56b431506a3b4f189dbd246bd18bdb44 (diff) | |
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_mutex.c')
| -rw-r--r-- | lib/libpthread/thread/thr_mutex.c | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/lib/libpthread/thread/thr_mutex.c b/lib/libpthread/thread/thr_mutex.c index b502c15af818..99599f120366 100644 --- a/lib/libpthread/thread/thr_mutex.c +++ b/lib/libpthread/thread/thr_mutex.c @@ -551,14 +551,6 @@ mutex_lock_common(struct pthread *curthread, pthread_mutex_t *m, /* Unlock the mutex structure: */ THR_LOCK_RELEASE(curthread, &(*m)->m_lock); } else { - /* Set the wakeup time: */ - if (abstime) { - curthread->wakeup_time.tv_sec = - abstime->tv_sec; - curthread->wakeup_time.tv_nsec = - abstime->tv_nsec; - } - /* * Join the queue of threads waiting to lock * the mutex and save a pointer to the mutex. @@ -572,6 +564,14 @@ mutex_lock_common(struct pthread *curthread, pthread_mutex_t *m, * be able to safely set the state. */ THR_SCHED_LOCK(curthread, curthread); + /* Set the wakeup time: */ + if (abstime) { + curthread->wakeup_time.tv_sec = + abstime->tv_sec; + curthread->wakeup_time.tv_nsec = + abstime->tv_nsec; + } + THR_SET_STATE(curthread, PS_MUTEX_WAIT); THR_SCHED_UNLOCK(curthread, curthread); @@ -633,14 +633,6 @@ mutex_lock_common(struct pthread *curthread, pthread_mutex_t *m, /* Unlock the mutex structure: */ THR_LOCK_RELEASE(curthread, &(*m)->m_lock); } else { - /* Set the wakeup time: */ - if (abstime) { - curthread->wakeup_time.tv_sec = - abstime->tv_sec; - curthread->wakeup_time.tv_nsec = - abstime->tv_nsec; - } - /* * Join the queue of threads waiting to lock * the mutex and save a pointer to the mutex. @@ -659,6 +651,13 @@ mutex_lock_common(struct pthread *curthread, pthread_mutex_t *m, mutex_priority_adjust(curthread, *m); THR_SCHED_LOCK(curthread, curthread); + /* Set the wakeup time: */ + if (abstime) { + curthread->wakeup_time.tv_sec = + abstime->tv_sec; + curthread->wakeup_time.tv_nsec = + abstime->tv_nsec; + } THR_SET_STATE(curthread, PS_MUTEX_WAIT); THR_SCHED_UNLOCK(curthread, curthread); @@ -730,14 +729,6 @@ mutex_lock_common(struct pthread *curthread, pthread_mutex_t *m, /* Unlock the mutex structure: */ THR_LOCK_RELEASE(curthread, &(*m)->m_lock); } else { - /* Set the wakeup time: */ - if (abstime) { - curthread->wakeup_time.tv_sec = - abstime->tv_sec; - curthread->wakeup_time.tv_nsec = - abstime->tv_nsec; - } - /* * Join the queue of threads waiting to lock * the mutex and save a pointer to the mutex. @@ -756,6 +747,13 @@ mutex_lock_common(struct pthread *curthread, pthread_mutex_t *m, */ THR_SCHED_LOCK(curthread, curthread); + /* Set the wakeup time: */ + if (abstime) { + curthread->wakeup_time.tv_sec = + abstime->tv_sec; + curthread->wakeup_time.tv_nsec = + abstime->tv_nsec; + } THR_SET_STATE(curthread, PS_MUTEX_WAIT); THR_SCHED_UNLOCK(curthread, curthread); |
