os: adopt nintendo ReaderWriter naming over ReadWrite
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
namespace ams::os::impl {
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
class ReadWriteLockHorizonImpl;
|
||||
class ReaderWriterLockHorizonImpl;
|
||||
#endif
|
||||
|
||||
class InternalConditionVariableImpl;
|
||||
@@ -28,7 +28,7 @@ namespace ams::os::impl {
|
||||
class InternalCriticalSectionImpl {
|
||||
private:
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
friend class ReadWriteLockHorizonImpl;
|
||||
friend class ReaderWriterLockHorizonImpl;
|
||||
#endif
|
||||
|
||||
friend class InternalConditionVariableImpl;
|
||||
|
||||
@@ -20,16 +20,16 @@
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
#include <stratosphere/os/impl/os_internal_rw_busy_mutex_impl.os.horizon.hpp>
|
||||
#else
|
||||
#error "Unknown OS for ams::os::impl::InternalReadWriteBusyMutexImpl"
|
||||
#error "Unknown OS for ams::os::impl::InternalReaderWriterBusyMutexImpl"
|
||||
#endif
|
||||
|
||||
namespace ams::os::impl {
|
||||
|
||||
class InternalReadWriteBusyMutex {
|
||||
class InternalReaderWriterBusyMutex {
|
||||
private:
|
||||
InternalReadWriteBusyMutexImpl m_impl;
|
||||
InternalReaderWriterBusyMutexImpl m_impl;
|
||||
public:
|
||||
constexpr InternalReadWriteBusyMutex() : m_impl() { /* ... */ }
|
||||
constexpr InternalReaderWriterBusyMutex() : m_impl() { /* ... */ }
|
||||
|
||||
ALWAYS_INLINE void AcquireReadLock() { return m_impl.AcquireReadLock(); }
|
||||
ALWAYS_INLINE void ReleaseReadLock() { return m_impl.ReleaseReadLock(); }
|
||||
@@ -38,6 +38,6 @@ namespace ams::os::impl {
|
||||
ALWAYS_INLINE void ReleaseWriteLock() { return m_impl.ReleaseWriteLock(); }
|
||||
};
|
||||
|
||||
using InternalReadWriteBusyMutexStorage = util::TypedStorage<InternalReadWriteBusyMutex>;
|
||||
using InternalReaderWriterBusyMutexStorage = util::TypedStorage<InternalReaderWriterBusyMutex>;
|
||||
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
|
||||
namespace ams::os::impl {
|
||||
|
||||
class InternalReadWriteBusyMutexImpl {
|
||||
class InternalReaderWriterBusyMutexImpl {
|
||||
private:
|
||||
u32 m_value;
|
||||
public:
|
||||
constexpr InternalReadWriteBusyMutexImpl() : m_value(0) { /* ... */ }
|
||||
constexpr InternalReaderWriterBusyMutexImpl() : m_value(0) { /* ... */ }
|
||||
|
||||
constexpr void Initialize() { m_value = 0; }
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
|
||||
namespace ams::os {
|
||||
|
||||
class ReadWriteBusyMutex {
|
||||
NON_COPYABLE(ReadWriteBusyMutex);
|
||||
NON_MOVEABLE(ReadWriteBusyMutex);
|
||||
class ReaderWriterBusyMutex {
|
||||
NON_COPYABLE(ReaderWriterBusyMutex);
|
||||
NON_MOVEABLE(ReaderWriterBusyMutex);
|
||||
private:
|
||||
ReadWriteBusyMutexType m_rw_mutex;
|
||||
ReaderWriterBusyMutexType m_rw_mutex;
|
||||
public:
|
||||
constexpr explicit ReadWriteBusyMutex() : m_rw_mutex{{0}} { /* ... */ }
|
||||
constexpr explicit ReaderWriterBusyMutex() : m_rw_mutex{{0}} { /* ... */ }
|
||||
|
||||
void AcquireReadLock() {
|
||||
return os::AcquireReadLockBusyMutex(std::addressof(m_rw_mutex));
|
||||
@@ -60,15 +60,15 @@ namespace ams::os {
|
||||
return this->ReleaseWriteLock();
|
||||
}
|
||||
|
||||
operator ReadWriteBusyMutexType &() {
|
||||
operator ReaderWriterBusyMutexType &() {
|
||||
return m_rw_mutex;
|
||||
}
|
||||
|
||||
operator const ReadWriteBusyMutexType &() const {
|
||||
operator const ReaderWriterBusyMutexType &() const {
|
||||
return m_rw_mutex;
|
||||
}
|
||||
|
||||
ReadWriteBusyMutexType *GetBase() {
|
||||
ReaderWriterBusyMutexType *GetBase() {
|
||||
return std::addressof(m_rw_mutex);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
|
||||
namespace ams::os {
|
||||
|
||||
struct ReadWriteBusyMutexType;
|
||||
struct ReaderWriterBusyMutexType;
|
||||
|
||||
void InitalizeReadWriteLockBusyMutex(ReadWriteBusyMutexType *rw_mutex);
|
||||
void InitalizeReaderWriterLockBusyMutex(ReaderWriterBusyMutexType *rw_mutex);
|
||||
|
||||
void AcquireReadLockBusyMutex(ReadWriteBusyMutexType *rw_mutex);
|
||||
void ReleaseReadLockBusyMutex(ReadWriteBusyMutexType *rw_mutex);
|
||||
void AcquireReadLockBusyMutex(ReaderWriterBusyMutexType *rw_mutex);
|
||||
void ReleaseReadLockBusyMutex(ReaderWriterBusyMutexType *rw_mutex);
|
||||
|
||||
void AcquireWriteLockBusyMutex(ReadWriteBusyMutexType *rw_mutex);
|
||||
void ReleaseWriteLockBusyMutex(ReadWriteBusyMutexType *rw_mutex);
|
||||
void AcquireWriteLockBusyMutex(ReaderWriterBusyMutexType *rw_mutex);
|
||||
void ReleaseWriteLockBusyMutex(ReaderWriterBusyMutexType *rw_mutex);
|
||||
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
|
||||
namespace ams::os {
|
||||
|
||||
struct ReadWriteBusyMutexType {
|
||||
struct ReaderWriterBusyMutexType {
|
||||
union {
|
||||
s32 _arr[sizeof(impl::InternalReadWriteBusyMutexStorage) / sizeof(s32)];
|
||||
impl::InternalReadWriteBusyMutexStorage _storage;
|
||||
s32 _arr[sizeof(impl::InternalReaderWriterBusyMutexStorage) / sizeof(s32)];
|
||||
impl::InternalReaderWriterBusyMutexStorage _storage;
|
||||
};
|
||||
};
|
||||
static_assert(std::is_trivial<ReadWriteBusyMutexType>::value);
|
||||
static_assert(std::is_trivial<ReaderWriterBusyMutexType>::value);
|
||||
|
||||
}
|
||||
|
||||
@@ -21,15 +21,15 @@
|
||||
|
||||
namespace ams::os {
|
||||
|
||||
class ReadWriteLock {
|
||||
NON_COPYABLE(ReadWriteLock);
|
||||
NON_MOVEABLE(ReadWriteLock);
|
||||
class ReaderWriterLock {
|
||||
NON_COPYABLE(ReaderWriterLock);
|
||||
NON_MOVEABLE(ReaderWriterLock);
|
||||
private:
|
||||
ReadWriteLockType rw_lock;
|
||||
ReaderWriterLockType rw_lock;
|
||||
public:
|
||||
constexpr explicit ReadWriteLock() : rw_lock{{}, 0, ::ams::os::ReadWriteLockType::State_Initialized, nullptr, 0, {}, {}} { /* ... */ }
|
||||
constexpr explicit ReaderWriterLock() : rw_lock{{}, 0, ::ams::os::ReaderWriterLockType::State_Initialized, nullptr, 0, {}, {}} { /* ... */ }
|
||||
|
||||
~ReadWriteLock() { os::FinalizeReadWriteLock(std::addressof(this->rw_lock)); }
|
||||
~ReaderWriterLock() { os::FinalizeReaderWriterLock(std::addressof(this->rw_lock)); }
|
||||
|
||||
void AcquireReadLock() {
|
||||
return os::AcquireReadLock(std::addressof(this->rw_lock));
|
||||
@@ -64,7 +64,7 @@ namespace ams::os {
|
||||
}
|
||||
|
||||
bool IsLockOwner() const {
|
||||
return os::IsReadWriteLockOwnerThread(std::addressof(this->rw_lock));
|
||||
return os::IsReaderWriterLockOwnerThread(std::addressof(this->rw_lock));
|
||||
}
|
||||
|
||||
void lock_shared() {
|
||||
@@ -91,15 +91,15 @@ namespace ams::os {
|
||||
return this->ReleaseWriteLock();
|
||||
}
|
||||
|
||||
operator ReadWriteLockType &() {
|
||||
operator ReaderWriterLockType &() {
|
||||
return this->rw_lock;
|
||||
}
|
||||
|
||||
operator const ReadWriteLockType &() const {
|
||||
operator const ReaderWriterLockType &() const {
|
||||
return this->rw_lock;
|
||||
}
|
||||
|
||||
ReadWriteLockType *GetBase() {
|
||||
ReaderWriterLockType *GetBase() {
|
||||
return std::addressof(this->rw_lock);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,21 +20,21 @@
|
||||
|
||||
namespace ams::os {
|
||||
|
||||
struct ReadWriteLockType;
|
||||
struct ReaderWriterLockType;
|
||||
|
||||
void InitalizeReadWriteLock(ReadWriteLockType *rw_lock);
|
||||
void FinalizeReadWriteLock(ReadWriteLockType *rw_lock);
|
||||
void InitalizeReaderWriterLock(ReaderWriterLockType *rw_lock);
|
||||
void FinalizeReaderWriterLock(ReaderWriterLockType *rw_lock);
|
||||
|
||||
void AcquireReadLock(ReadWriteLockType *rw_lock);
|
||||
bool TryAcquireReadLock(ReadWriteLockType *rw_lock);
|
||||
void ReleaseReadLock(ReadWriteLockType *rw_lock);
|
||||
void AcquireReadLock(ReaderWriterLockType *rw_lock);
|
||||
bool TryAcquireReadLock(ReaderWriterLockType *rw_lock);
|
||||
void ReleaseReadLock(ReaderWriterLockType *rw_lock);
|
||||
|
||||
void AcquireWriteLock(ReadWriteLockType *rw_lock);
|
||||
bool TryAcquireWriteLock(ReadWriteLockType *rw_lock);
|
||||
void ReleaseWriteLock(ReadWriteLockType *rw_lock);
|
||||
void AcquireWriteLock(ReaderWriterLockType *rw_lock);
|
||||
bool TryAcquireWriteLock(ReaderWriterLockType *rw_lock);
|
||||
void ReleaseWriteLock(ReaderWriterLockType *rw_lock);
|
||||
|
||||
bool IsReadLockHeld(const ReadWriteLockType *rw_lock);
|
||||
bool IsWriteLockHeldByCurrentThread(const ReadWriteLockType *rw_lock);
|
||||
bool IsReadWriteLockOwnerThread(const ReadWriteLockType *rw_lock);
|
||||
bool IsReadLockHeld(const ReaderWriterLockType *rw_lock);
|
||||
bool IsWriteLockHeldByCurrentThread(const ReaderWriterLockType *rw_lock);
|
||||
bool IsReaderWriterLockOwnerThread(const ReaderWriterLockType *rw_lock);
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
namespace ams::os {
|
||||
|
||||
constexpr inline s32 ReadWriteLockCountMax = (1 << (BITSIZEOF(u16) - 1)) - 1;
|
||||
constexpr inline s32 ReadWriteLockWaiterCountMax = (1 << BITSIZEOF(u8)) - 1;
|
||||
constexpr inline s32 ReaderWriterLockCountMax = (1 << (BITSIZEOF(u16) - 1)) - 1;
|
||||
constexpr inline s32 ReaderWriterLockWaiterCountMax = (1 << BITSIZEOF(u8)) - 1;
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace ams::os {
|
||||
|
||||
struct ThreadType;
|
||||
|
||||
struct ReadWriteLockType {
|
||||
struct ReaderWriterLockType {
|
||||
enum State {
|
||||
State_NotInitialized = 0,
|
||||
State_Initialized = 1,
|
||||
@@ -65,6 +65,6 @@ namespace ams::os {
|
||||
impl::InternalConditionVariableStorage _storage;
|
||||
} cv_write_lock;
|
||||
};
|
||||
static_assert(std::is_trivial<ReadWriteLockType>::value);
|
||||
static_assert(std::is_trivial<ReaderWriterLockType>::value);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user