[sheepdog] [PATCH v2 1/2] lib: add a wrapper for pthread_mutex_trylock()

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Thu Dec 26 04:51:05 CET 2013


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

diff --git a/include/util.h b/include/util.h
index 12270ec..3df2eec 100644
--- a/include/util.h
+++ b/include/util.h
@@ -312,6 +312,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