Return a non-NULL owner only if the lock is exclusively held in owner_sx().
Fix some whitespace bugs while here. MFC after: 2 weeks
This commit is contained in:
parent
3ca2845d13
commit
c365a2934e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=309783
@ -215,12 +215,14 @@ unlock_sx(struct lock_object *lock)
|
||||
int
|
||||
owner_sx(const struct lock_object *lock, struct thread **owner)
|
||||
{
|
||||
const struct sx *sx = (const struct sx *)lock;
|
||||
uintptr_t x = sx->sx_lock;
|
||||
const struct sx *sx;
|
||||
uintptr_t x;
|
||||
|
||||
*owner = (struct thread *)SX_OWNER(x);
|
||||
return ((x & SX_LOCK_SHARED) != 0 ? (SX_SHARERS(x) != 0) :
|
||||
(*owner != NULL));
|
||||
sx = (const struct sx *)lock;
|
||||
x = sx->sx_lock;
|
||||
*owner = NULL;
|
||||
return ((x & SX_LOCK_SHARED) != 0 ? (SX_SHARERS(x) != 0) :
|
||||
((*owner = (struct thread *)SX_OWNER(x)) != NULL));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user