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 {