15 #include "vxl_config.h" 16 #include "vpl/vpl_export.h" 20 struct VPL_EXPORT vpl_mutex
22 vpl_mutex() { pthread_mutex_init(&mutex_,
nullptr); }
24 void lock() { pthread_mutex_lock(&mutex_); }
27 bool trylock() {
return pthread_mutex_trylock(&mutex_) != EBUSY; }
29 void unlock() { pthread_mutex_unlock(&mutex_); }
31 ~vpl_mutex() { pthread_mutex_destroy(&mutex_); }
34 pthread_mutex_t mutex_;
37 vpl_mutex(vpl_mutex
const &) { }
38 vpl_mutex& operator=(vpl_mutex
const &) {
return *
this; }
42 # error "only works with pthreads for now" 45 #endif // vpl_mutex_h_