18 #ifndef LIBCWD_PRIVATE_LOCK_INTERFACE_H
19 #define LIBCWD_PRIVATE_LOCK_INTERFACE_H
21 #if LIBCWD_THREAD_SAFE
25 class lock_interface_base_ct {
27 virtual int trylock(
void) = 0;
28 virtual void lock(
void) = 0;
29 virtual void unlock(
void) = 0;
30 virtual ~lock_interface_base_ct() { }
34 class lock_interface_tct :
public lock_interface_base_ct {
37 virtual int trylock(
void) {
return ptr->trylock(); }
38 virtual void lock(
void) { ptr->lock(); }
39 virtual void unlock(
void) { ptr->unlock(); }
41 lock_interface_tct(T* mutex) : ptr(mutex) { }
44 class pthread_lock_interface_ct :
public lock_interface_base_ct {
47 virtual int trylock(
void);
48 virtual void lock(
void);
49 virtual void unlock(
void);
51 pthread_lock_interface_ct(pthread_mutex_t* mutex) : ptr(mutex) { }
57 #endif // LIBCWD_THREAD_SAFE
58 #endif // LIBCWD_PRIVATE_LOCK_INTERFACE_H