rtmutex: Add rtmutex_lock_killable()

Add "killable" type to rtmutex. We need this since rtmutex are used as
"normal" mutexes which do use this type.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Thomas Gleixner 2011-06-09 11:43:52 +02:00 committed by Alibek Omarov
parent f4d2cdae88
commit 64474cb7c1
2 changed files with 20 additions and 0 deletions

View File

@ -115,6 +115,7 @@ extern void rt_mutex_lock(struct rt_mutex *lock);
#endif
extern int rt_mutex_lock_interruptible(struct rt_mutex *lock);
extern int rt_mutex_lock_killable(struct rt_mutex *lock);
extern int rt_mutex_timed_lock(struct rt_mutex *lock,
struct hrtimer_sleeper *timeout);

View File

@ -1561,6 +1561,25 @@ int __sched __rt_mutex_futex_trylock(struct rt_mutex *lock)
return __rt_mutex_slowtrylock(lock);
}
/**
* rt_mutex_lock_killable - lock a rt_mutex killable
*
* @lock: the rt_mutex to be locked
* @detect_deadlock: deadlock detection on/off
*
* Returns:
* 0 on success
* -EINTR when interrupted by a signal
* -EDEADLK when the lock would deadlock (when deadlock detection is on)
*/
int __sched rt_mutex_lock_killable(struct rt_mutex *lock)
{
might_sleep();
return rt_mutex_fastlock(lock, TASK_KILLABLE, rt_mutex_slowlock);
}
EXPORT_SYMBOL_GPL(rt_mutex_lock_killable);
/**
* rt_mutex_timed_lock - lock a rt_mutex interruptible
* the timeout structure is provided