38 # include <dsn/utility/extensible_object.h> 40 namespace dsn {
namespace service {
58 virtual void lock() = 0;
59 virtual bool try_lock() = 0;
60 virtual void unlock() = 0;
71 return new T(inner_provider);
77 virtual ~
lock_provider() {
if (
nullptr != _inner_provider)
delete _inner_provider; }
78 lock_provider* get_inner_provider()
const {
return _inner_provider; }
92 return new T(inner_provider);
99 virtual ~
lock_nr_provider() {
if (
nullptr != _inner_provider)
delete _inner_provider; }
114 return new T(inner_provider);
121 virtual ~
rwlock_nr_provider() {
if (
nullptr != _inner_provider)
delete _inner_provider; }
123 virtual void lock_read() = 0;
124 virtual void unlock_read() = 0;
125 virtual bool try_lock_read() = 0;
127 virtual void lock_write() = 0;
128 virtual void unlock_write() = 0;
129 virtual bool try_lock_write() = 0;
145 return new T(initCount, inner_provider);
152 virtual ~
semaphore_provider() {
if (
nullptr != _inner_provider)
delete _inner_provider; }
155 virtual void signal(
int count) = 0;
156 virtual bool wait(
int timeout_milliseconds = TIME_MS_MAX) = 0;
non-recursive exclusive lock
Definition: zlock_provider.h:87
recursive exclusive lock
Definition: zlock_provider.h:66
non-recursive rwlock
Definition: zlock_provider.h:109
semaphore
Definition: zlock_provider.h:140
lock interface
Definition: zlock_provider.h:54