我想检入一个struct mutex
,该{_1}已锁定在该互斥锁的所有者的内核中。
struct mutex {
atomic_long_t owner;
spinlock_t wait_lock;
#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
struct optimistic_spin_queue osq; /* Spinner MCS lock */
#endif
struct list_head wait_list;
#ifdef CONFIG_DEBUG_MUTEXES
void *magic;
#endif
#ifdef CONFIG_DEBUG_LOCK_ALLOC
struct lockdep_map dep_map;
#endif
};
我从here获悉:
字段所有者实际上包含struct task_struct *到当前锁 所有者,因此如果当前不拥有,则为NULL。
有没有安全的方法将该字段与current
进行比较?