From 16f7fd4dc032b99d4af60703c2340c149bf723df Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Sun, 23 Aug 2015 13:16:44 +0200 Subject: [PATCH] the weather is cloudy this Sunday --- src/jniutils.hh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/jniutils.hh b/src/jniutils.hh index 50e3305..a523f65 100644 --- a/src/jniutils.hh +++ b/src/jniutils.hh @@ -13,7 +13,8 @@ namespace pEp { using namespace std; class mutex { - pthread_mutex_t _mutex; + typedef pthread_mutex_t native_handle_type; + native_handle_type _mutex; public: mutex() { @@ -31,6 +32,12 @@ namespace pEp { void unlock() { pthread_mutex_unlock(&_mutex); } + native_handle_type native_handle() { + return _mutex; + } + bool try_lock() { + return pthread_mutex_trylock(&_mutex) == 0; + } }; template class lock_guard {