diff --git a/src/config.hpp b/src/config.hpp index d30785bf..c20cf102 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -47,7 +47,6 @@ #include "fuse_cfg.hpp" #include "fuse_readdir.hpp" #include "policy.hpp" -#include "rwlock.hpp" #include "tofrom_ref.hpp" #include "tofrom_wrapper.hpp" #include "syslog.hpp" diff --git a/src/policy_epff.cpp b/src/policy_epff.cpp index 871d8d6f..71323eeb 100644 --- a/src/policy_epff.cpp +++ b/src/policy_epff.cpp @@ -26,7 +26,6 @@ #include "fs_statvfs_cache.hpp" #include "policy.hpp" #include "policy_error.hpp" -#include "rwlock.hpp" #include #include diff --git a/src/policy_eplus.cpp b/src/policy_eplus.cpp index 5f57f351..2884de11 100644 --- a/src/policy_eplus.cpp +++ b/src/policy_eplus.cpp @@ -25,7 +25,6 @@ #include "fs_statvfs_cache.hpp" #include "policy.hpp" #include "policy_error.hpp" -#include "rwlock.hpp" #include #include diff --git a/src/policy_eppfrd.cpp b/src/policy_eppfrd.cpp index 7a1c6ce0..6220d2ea 100644 --- a/src/policy_eppfrd.cpp +++ b/src/policy_eppfrd.cpp @@ -26,7 +26,6 @@ #include "policy.hpp" #include "policy_error.hpp" #include "rnd.hpp" -#include "rwlock.hpp" #include "strvec.hpp" #include diff --git a/src/policy_lup.cpp b/src/policy_lup.cpp index f154a635..a7f13db4 100644 --- a/src/policy_lup.cpp +++ b/src/policy_lup.cpp @@ -26,7 +26,6 @@ #include "fs_statvfs_cache.hpp" #include "policy.hpp" #include "policy_error.hpp" -#include "rwlock.hpp" #include "base_types.h" diff --git a/src/policy_newest.cpp b/src/policy_newest.cpp index 357b606f..fe3a96a2 100644 --- a/src/policy_newest.cpp +++ b/src/policy_newest.cpp @@ -25,7 +25,6 @@ #include "fs_statvfs_cache.hpp" #include "policy.hpp" #include "policy_error.hpp" -#include "rwlock.hpp" #include #include diff --git a/src/rwlock.hpp b/src/rwlock.hpp deleted file mode 100644 index e72c828b..00000000 --- a/src/rwlock.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - ISC License - - Copyright (c) 2026, Antonio SJ Musumeci - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#pragma once - -#include - -namespace rwlock -{ - class ReadGuard - { - public: - ReadGuard(pthread_rwlock_t &lock_) - : _lock(lock_) - { - pthread_rwlock_rdlock(&_lock); - } - - ~ReadGuard() - { - pthread_rwlock_unlock(&_lock); - } - - private: - ReadGuard(); - - private: - pthread_rwlock_t &_lock; - }; - - class WriteGuard - { - public: - WriteGuard(pthread_rwlock_t &lock_) - : _lock(lock_) - { - pthread_rwlock_wrlock(&_lock); - } - - ~WriteGuard() - { - pthread_rwlock_unlock(&_lock); - } - - private: - WriteGuard(); - - private: - pthread_rwlock_t &_lock; - }; -}