From: Charles Myers <charles.my...@spirent.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

bsd: Added mtx_trylock()

Used in FreeBSD IPv6 code sys/netinet6/frag6.c IP6Q_TRYLOCK().
Message-Id: <1533351790-4194-1-git-send-email-charles.my...@spirent.com>

---
diff --git a/bsd/porting/sync_stub.c b/bsd/porting/sync_stub.c
--- a/bsd/porting/sync_stub.c
+++ b/bsd/porting/sync_stub.c
@@ -26,6 +26,11 @@ void mtx_lock(struct mtx *mp)
     mutex_lock(&mp->_mutex);
 }

+int mtx_trylock(struct mtx *mp)
+{
+    return mutex_trylock(&mp->_mutex) ? 1 : 0;
+}
+
 void mtx_unlock(struct mtx *mp)
 {
     mutex_unlock(&mp->_mutex);
diff --git a/bsd/porting/sync_stub.h b/bsd/porting/sync_stub.h
--- a/bsd/porting/sync_stub.h
+++ b/bsd/porting/sync_stub.h
@@ -32,6 +32,7 @@ __BEGIN_DECLS
 void mtx_init(struct mtx *m, const char *name, const char *type, int opts);
 void mtx_destroy(struct mtx *m);
 void mtx_lock(struct mtx *mp);
+int mtx_trylock(struct mtx *mp);
 void mtx_unlock(struct mtx *mp);
 void mtx_assert(struct mtx *mp, int flag);

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to