2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-02 06:55:16 +00:00

[#1147] Checkpoint: camelized method names

This commit is contained in:
Francis Dupont
2020-05-14 15:21:34 +02:00
parent d2ec1fcfc8
commit 03b2d111d9

View File

@@ -51,7 +51,7 @@ public:
} }
/// @brief Lock write. /// @brief Lock write.
void lock_write() { void writeLock() {
std::unique_lock<std::mutex> lk(mutex_); std::unique_lock<std::mutex> lk(mutex_);
// Wait until the write entered flag can be set. // Wait until the write entered flag can be set.
gate1_.wait(lk, [=]() { return (!writeEntered()); }); gate1_.wait(lk, [=]() { return (!writeEntered()); });
@@ -63,7 +63,7 @@ public:
/// @brief Unlock write. /// @brief Unlock write.
/// ///
/// @note: do not check that WRITE_ENTERED was set. /// @note: do not check that WRITE_ENTERED was set.
void unlock_write() { void writeUnlock() {
std::lock_guard<std::mutex> lk(mutex_); std::lock_guard<std::mutex> lk(mutex_);
state_ = 0; state_ = 0;
// Wake-up readers when exiting the guard. // Wake-up readers when exiting the guard.
@@ -71,7 +71,7 @@ public:
} }
/// @brief Lock read. /// @brief Lock read.
void lock_read() { void readLock() {
std::unique_lock<std::mutex> lk(mutex_); std::unique_lock<std::mutex> lk(mutex_);
// Wait if there is a writer or if readers overflow. // Wait if there is a writer or if readers overflow.
gate1_.wait(lk, [=]() { return (state_ < MAX_READERS); }); gate1_.wait(lk, [=]() { return (state_ < MAX_READERS); });
@@ -81,7 +81,7 @@ public:
/// @brief Unlock read. /// @brief Unlock read.
/// ///
/// @note: do not check that there is a least one reader. /// @note: do not check that there is a least one reader.
void unlock_read() { void readUnlock() {
std::lock_guard<std::mutex> lk(mutex_); std::lock_guard<std::mutex> lk(mutex_);
unsigned prev = state_--; unsigned prev = state_--;
if (writeEntered()) { if (writeEntered()) {
@@ -144,12 +144,12 @@ public:
/// ///
/// @param rw_mutex The read mutex. /// @param rw_mutex The read mutex.
ReadLockGuard(ReadWriteMutex& rw_mutex) : rw_mutex_(rw_mutex) { ReadLockGuard(ReadWriteMutex& rw_mutex) : rw_mutex_(rw_mutex) {
rw_mutex_.lock_read(); rw_mutex_.readLock();
} }
/// @brief Destructor. /// @brief Destructor.
virtual ~ReadLockGuard() { virtual ~ReadLockGuard() {
rw_mutex_.unlock_read(); rw_mutex_.readUnlock();
} }
private: private:
@@ -168,12 +168,12 @@ public:
/// ///
/// @param rw_mutex The write mutex. /// @param rw_mutex The write mutex.
WriteLockGuard(ReadWriteMutex& rw_mutex) : rw_mutex_(rw_mutex) { WriteLockGuard(ReadWriteMutex& rw_mutex) : rw_mutex_(rw_mutex) {
rw_mutex_.lock_write(); rw_mutex_.writeLock();
} }
/// @brief Destructor. /// @brief Destructor.
virtual ~WriteLockGuard() { virtual ~WriteLockGuard() {
rw_mutex_.unlock_write(); rw_mutex_.writeUnlock();
} }
private: private: