diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/sys/mutex.h | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/include/sys/mutex.h b/include/sys/mutex.h index ebf9151f1..659214f50 100644 --- a/include/sys/mutex.h +++ b/include/sys/mutex.h @@ -48,21 +48,18 @@ typedef struct { static inline kthread_t * mutex_owner(kmutex_t *mp) { - struct thread_info *owner; - - owner = ACCESS_ONCE(mp->m.owner); - if (owner) - return owner->task; - - return NULL; -} +#if defined(HAVE_MUTEX_OWNER_TASK_STRUCT) + return ACCESS_ONCE(mp->m.owner); +#else + struct thread_info *owner = ACCESS_ONCE(mp->m.owner); + if (owner) + return owner->task; -static inline int -mutex_owned(kmutex_t *mp) -{ - return (ACCESS_ONCE(mp->m.owner) == current_thread_info()); + return NULL; +#endif } +#define mutex_owned(mp) (mutex_owner(mp) == current) #define MUTEX_HELD(mp) mutex_owned(mp) #define MUTEX_NOT_HELD(mp) (!MUTEX_HELD(mp)) #undef mutex_init |