Switch_lock::lock_owner() const
{
Lock_guard<Cpu_lock> guard(&cpu_lock);
- return (EXPECT_TRUE(valid())) ? (Context*)_lock_owner : 0;
+ return (Context*)(_lock_owner & ~1UL);
}
/** Is lock set?.
Lock_guard<Cpu_lock> guard(&cpu_lock);
if (EXPECT_FALSE(!valid()))
return Invalid;
- return _lock_owner & ~1UL ? Locked : Not_locked;
+ return (_lock_owner & ~1UL) ? Locked : Not_locked;
}
/** Try to acquire the lock.
return Invalid;
// have we already the lock?
- if (Address(_lock_owner) & ~1UL == Address(current()))
+ if ((_lock_owner & ~1UL) == Address(current()))
return Locked;
while (test())
assert (!valid());
// have we already the lock?
- if (lock_owner() == current())
+ if ((_lock_owner & ~1UL) == (Address)current())
{
set_lock_owner(0);
current()->dec_lock_cnt();