Browse Source

the weather is cloudy this Sunday

JNI-44
Volker Birk 10 years ago
parent
commit
16f7fd4dc0
  1. 9
      src/jniutils.hh

9
src/jniutils.hh

@ -13,7 +13,8 @@ namespace pEp {
using namespace std; using namespace std;
class mutex { class mutex {
pthread_mutex_t _mutex; typedef pthread_mutex_t native_handle_type;
native_handle_type _mutex;
public: public:
mutex() { mutex() {
@ -31,6 +32,12 @@ namespace pEp {
void unlock() { void unlock() {
pthread_mutex_unlock(&_mutex); pthread_mutex_unlock(&_mutex);
} }
native_handle_type native_handle() {
return _mutex;
}
bool try_lock() {
return pthread_mutex_trylock(&_mutex) == 0;
}
}; };
template<class T> class lock_guard { template<class T> class lock_guard {

Loading…
Cancel
Save