In cpu_switch(), use an atomic operation to set the td_lock

of the old thread to the mutex that's passed.

Pointed out by: attilio, jhb
This commit is contained in:
Marcel Moolenaar 2010-01-27 02:32:07 +00:00
parent 5c335c81b3
commit 9d908720aa

View File

@ -442,7 +442,7 @@ cpu_switch(struct thread *old, struct thread *new, struct mtx *mtx)
if (PCPU_GET(fpcurthread) == old)
old->td_frame->tf_special.psr |= IA64_PSR_DFH;
if (!savectx(oldpcb)) {
old->td_lock = mtx;
atomic_store_rel_ptr(&old->td_lock, mtx);
#if defined(SCHED_ULE) && defined(SMP)
/* td_lock is volatile */
while (new->td_lock == &blocked_lock)