Mark the thread pointer used during an adaptive spin volatile so that the

compiler doesn't decide to cache td_state.  Cachine the state would cause
the spinning thread to not notice when the owning thread stopped executing
(if it was preempted for example) which could result in livelock.
This commit is contained in:
John Baldwin 2006-04-14 19:51:50 +00:00
parent 1427d59bee
commit 76447e5618

View File

@ -449,7 +449,7 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t tid, int opts, const char *file,
int line)
{
#if defined(SMP) && !defined(NO_ADAPTIVE_MUTEXES)
struct thread *owner;
volatile struct thread *owner;
#endif
uintptr_t v;
#ifdef KTR