October 2017
Intermediate to advanced
586 pages
14h 8m
English
void mutex_lock(struct mutex *lock); int mutex_lock_interruptible(struct mutex *lock); int mutex_lock_killable(struct mutex *lock);
void mutex_unlock(struct mutex *lock);
Sometimes, you may only need to check whether a mutex is locked or not. For that purpose, you can use the int mutex_is_locked(struct mutex *lock) function:
int mutex_is_locked(struct mutex *lock);
What this function does is just check whether the mutex's owner is empty (NULL) or not. There is also mutex_trylock, which acquires the mutex if it is not already locked and returns 1; otherwise, it returns 0:
int mutex_trylock(struct mutex *lock);
As with the wait queue's interruptible family function, mutex_lock_interruptible(), which ...