Expose sx_xholder() as a public macro. It returns a pointer to the thread
that holds the current exclusive lock, or NULL if no thread holds an exclusive lock. Requested by: pjd
This commit is contained in:
parent
7229ab21b7
commit
71a95881d4
@ -101,14 +101,6 @@ __FBSDID("$FreeBSD$");
|
||||
*/
|
||||
#define sx_recursed(sx) ((sx)->sx_recurse != 0)
|
||||
|
||||
/*
|
||||
* Return a pointer to the owning thread if the lock is exclusively
|
||||
* locked.
|
||||
*/
|
||||
#define sx_xholder(sx) \
|
||||
((sx)->sx_lock & SX_LOCK_SHARED ? NULL : \
|
||||
(struct thread *)SX_OWNER((sx)->sx_lock))
|
||||
|
||||
#ifdef DDB
|
||||
static void db_show_sx(struct lock_object *lock);
|
||||
#endif
|
||||
|
@ -213,6 +213,14 @@ struct sx_args {
|
||||
#define sx_try_upgrade(sx) _sx_try_upgrade((sx), LOCK_FILE, LOCK_LINE)
|
||||
#define sx_downgrade(sx) _sx_downgrade((sx), LOCK_FILE, LOCK_LINE)
|
||||
|
||||
/*
|
||||
* Return a pointer to the owning thread if the lock is exclusively
|
||||
* locked.
|
||||
*/
|
||||
#define sx_xholder(sx) \
|
||||
((sx)->sx_lock & SX_LOCK_SHARED ? NULL : \
|
||||
(struct thread *)SX_OWNER((sx)->sx_lock))
|
||||
|
||||
#define sx_xlocked(sx) \
|
||||
(((sx)->sx_lock & ~(SX_LOCK_FLAGMASK & ~SX_LOCK_SHARED)) == \
|
||||
(uintptr_t)curthread)
|
||||
|
Loading…
x
Reference in New Issue
Block a user