[sheepdog] [PATCH stable-0.7 3/9] lib: add a wrapper for pthread_mutex_trylock()

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Fri Jan 31 06:46:38 CET 2014


Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 include/util.h |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/util.h b/include/util.h
index 101503f..e0cc0c5 100644
--- a/include/util.h
+++ b/include/util.h
@@ -303,6 +303,11 @@ static inline void sd_mutex_lock(struct sd_mutex *mutex)
 		panic("failed to lock for reading, %s", strerror(ret));
 }
 
+static inline int sd_mutex_trylock(struct sd_mutex *mutex)
+{
+	return pthread_mutex_trylock(&mutex->mutex);
+}
+
 static inline void sd_mutex_unlock(struct sd_mutex *mutex)
 {
 	int ret;
-- 
1.7.10.4




More information about the sheepdog mailing list