]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
rtmutex-lock-killable.patch
authorThomas Gleixner <tglx@linutronix.de>
Thu, 9 Jun 2011 09:43:52 +0000 (11:43 +0200)
committerMichal Sojka <sojka@merica.cz>
Sun, 13 Sep 2015 07:47:21 +0000 (09:47 +0200)
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/rtmutex.h
kernel/locking/rtmutex.c

index 1abba5ce2a2f38b31b7611588faddc6f26cfe457..51dc12e3860cd344d12e2c0f6fa1d710246d7bdd 100644 (file)
@@ -91,6 +91,7 @@ extern void rt_mutex_destroy(struct rt_mutex *lock);
 
 extern void rt_mutex_lock(struct rt_mutex *lock);
 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);
 
index e41164d1504409060deb6fa57530d75bd0673958..362ebcc50867b10c2747d1936477cefbd2994a90 100644 (file)
@@ -1440,6 +1440,25 @@ int rt_mutex_timed_futex_lock(struct rt_mutex *lock,
                                       rt_mutex_slowlock);
 }
 
+/**
+ * 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