strat: use m_ for member variables
This commit is contained in:
@@ -28,28 +28,28 @@ namespace ams::os::impl {
|
||||
|
||||
class InternalConditionVariable {
|
||||
private:
|
||||
InternalConditionVariableImpl impl;
|
||||
InternalConditionVariableImpl m_impl;
|
||||
public:
|
||||
constexpr InternalConditionVariable() : impl() { /* ... */ }
|
||||
constexpr InternalConditionVariable() : m_impl() { /* ... */ }
|
||||
|
||||
constexpr void Initialize() {
|
||||
this->impl.Initialize();
|
||||
m_impl.Initialize();
|
||||
}
|
||||
|
||||
void Signal() {
|
||||
this->impl.Signal();
|
||||
m_impl.Signal();
|
||||
}
|
||||
|
||||
void Broadcast() {
|
||||
this->impl.Broadcast();
|
||||
m_impl.Broadcast();
|
||||
}
|
||||
|
||||
void Wait(InternalCriticalSection *cs) {
|
||||
this->impl.Wait(cs);
|
||||
m_impl.Wait(cs);
|
||||
}
|
||||
|
||||
ConditionVariableStatus TimedWait(InternalCriticalSection *cs, const TimeoutHelper &timeout_helper) {
|
||||
return this->impl.TimedWait(cs, timeout_helper);
|
||||
return m_impl.TimedWait(cs, timeout_helper);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@ namespace ams::os::impl {
|
||||
|
||||
class InternalConditionVariableImpl {
|
||||
private:
|
||||
u32 value;
|
||||
u32 m_value;
|
||||
public:
|
||||
constexpr InternalConditionVariableImpl() : value(0) { /* ... */ }
|
||||
constexpr InternalConditionVariableImpl() : m_value(0) { /* ... */ }
|
||||
|
||||
constexpr void Initialize() {
|
||||
this->value = 0;
|
||||
m_value = 0;
|
||||
}
|
||||
|
||||
void Signal();
|
||||
|
||||
@@ -27,18 +27,18 @@ namespace ams::os::impl {
|
||||
|
||||
class InternalCriticalSection {
|
||||
private:
|
||||
InternalCriticalSectionImpl impl;
|
||||
InternalCriticalSectionImpl m_impl;
|
||||
public:
|
||||
constexpr InternalCriticalSection() : impl() { /* ... */ }
|
||||
constexpr InternalCriticalSection() : m_impl() { /* ... */ }
|
||||
|
||||
constexpr void Initialize() { this->impl.Initialize(); }
|
||||
constexpr void Finalize() { this->impl.Finalize(); }
|
||||
constexpr void Initialize() { m_impl.Initialize(); }
|
||||
constexpr void Finalize() { m_impl.Finalize(); }
|
||||
|
||||
void Enter() { return this->impl.Enter(); }
|
||||
bool TryEnter() { return this->impl.TryEnter(); }
|
||||
void Leave() { return this->impl.Leave(); }
|
||||
void Enter() { return m_impl.Enter(); }
|
||||
bool TryEnter() { return m_impl.TryEnter(); }
|
||||
void Leave() { return m_impl.Leave(); }
|
||||
|
||||
bool IsLockedByCurrentThread() const { return this->impl.IsLockedByCurrentThread(); }
|
||||
bool IsLockedByCurrentThread() const { return m_impl.IsLockedByCurrentThread(); }
|
||||
|
||||
ALWAYS_INLINE void Lock() { return this->Enter(); }
|
||||
ALWAYS_INLINE bool TryLock() { return this->TryEnter(); }
|
||||
@@ -49,11 +49,11 @@ namespace ams::os::impl {
|
||||
ALWAYS_INLINE void unlock() { return this->Unlock(); }
|
||||
|
||||
InternalCriticalSectionImpl *Get() {
|
||||
return std::addressof(this->impl);
|
||||
return std::addressof(m_impl);
|
||||
}
|
||||
|
||||
const InternalCriticalSectionImpl *Get() const {
|
||||
return std::addressof(this->impl);
|
||||
return std::addressof(m_impl);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ namespace ams::os::impl {
|
||||
|
||||
friend class InternalConditionVariableImpl;
|
||||
private:
|
||||
u32 thread_handle;
|
||||
u32 m_thread_handle;
|
||||
public:
|
||||
constexpr InternalCriticalSectionImpl() : thread_handle(svc::InvalidHandle) { /* ... */ }
|
||||
constexpr InternalCriticalSectionImpl() : m_thread_handle(svc::InvalidHandle) { /* ... */ }
|
||||
|
||||
constexpr void Initialize() { this->thread_handle = svc::InvalidHandle; }
|
||||
constexpr void Initialize() { m_thread_handle = svc::InvalidHandle; }
|
||||
constexpr void Finalize() { /* ... */ }
|
||||
|
||||
void Enter();
|
||||
|
||||
@@ -27,38 +27,38 @@ namespace ams::os {
|
||||
NON_COPYABLE(ConditionVariable);
|
||||
NON_MOVEABLE(ConditionVariable);
|
||||
private:
|
||||
ConditionVariableType cv;
|
||||
ConditionVariableType m_cv;
|
||||
public:
|
||||
constexpr ConditionVariable() : cv{::ams::os::ConditionVariableType::State_Initialized, {{0}}} { /* ... */ }
|
||||
constexpr ConditionVariable() : m_cv{::ams::os::ConditionVariableType::State_Initialized, {{0}}} { /* ... */ }
|
||||
|
||||
~ConditionVariable() { FinalizeConditionVariable(std::addressof(this->cv)); }
|
||||
~ConditionVariable() { FinalizeConditionVariable(std::addressof(m_cv)); }
|
||||
|
||||
void Signal() {
|
||||
SignalConditionVariable(std::addressof(this->cv));
|
||||
SignalConditionVariable(std::addressof(m_cv));
|
||||
}
|
||||
|
||||
void Broadcast() {
|
||||
BroadcastConditionVariable(std::addressof(this->cv));
|
||||
BroadcastConditionVariable(std::addressof(m_cv));
|
||||
}
|
||||
|
||||
void Wait(ams::os::MutexType &mutex) {
|
||||
WaitConditionVariable(std::addressof(this->cv), std::addressof(mutex));
|
||||
WaitConditionVariable(std::addressof(m_cv), std::addressof(mutex));
|
||||
}
|
||||
|
||||
ConditionVariableStatus TimedWait(ams::os::MutexType &mutex, TimeSpan timeout) {
|
||||
return TimedWaitConditionVariable(std::addressof(this->cv), std::addressof(mutex), timeout);
|
||||
return TimedWaitConditionVariable(std::addressof(m_cv), std::addressof(mutex), timeout);
|
||||
}
|
||||
|
||||
operator ConditionVariableType &() {
|
||||
return this->cv;
|
||||
return m_cv;
|
||||
}
|
||||
|
||||
operator const ConditionVariableType &() const {
|
||||
return this->cv;
|
||||
return m_cv;
|
||||
}
|
||||
|
||||
ConditionVariableType *GetBase() {
|
||||
return std::addressof(this->cv);
|
||||
return std::addressof(m_cv);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -26,46 +26,46 @@ namespace ams::os {
|
||||
NON_COPYABLE(Event);
|
||||
NON_MOVEABLE(Event);
|
||||
private:
|
||||
EventType event;
|
||||
EventType m_event;
|
||||
public:
|
||||
explicit Event(EventClearMode clear_mode) {
|
||||
InitializeEvent(std::addressof(this->event), false, clear_mode);
|
||||
InitializeEvent(std::addressof(m_event), false, clear_mode);
|
||||
}
|
||||
|
||||
~Event() {
|
||||
FinalizeEvent(std::addressof(this->event));
|
||||
FinalizeEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
void Wait() {
|
||||
return WaitEvent(std::addressof(this->event));
|
||||
return WaitEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
bool TryWait() {
|
||||
return TryWaitEvent(std::addressof(this->event));
|
||||
return TryWaitEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
bool TimedWait(TimeSpan timeout) {
|
||||
return TimedWaitEvent(std::addressof(this->event), timeout);
|
||||
return TimedWaitEvent(std::addressof(m_event), timeout);
|
||||
}
|
||||
|
||||
void Signal() {
|
||||
return SignalEvent(std::addressof(this->event));
|
||||
return SignalEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
void Clear() {
|
||||
return ClearEvent(std::addressof(this->event));
|
||||
return ClearEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
operator EventType &() {
|
||||
return this->event;
|
||||
return m_event;
|
||||
}
|
||||
|
||||
operator const EventType &() const {
|
||||
return this->event;
|
||||
return m_event;
|
||||
}
|
||||
|
||||
EventType *GetBase() {
|
||||
return std::addressof(this->event);
|
||||
return std::addressof(m_event);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -27,42 +27,42 @@ namespace ams::os {
|
||||
NON_COPYABLE(InterruptEvent);
|
||||
NON_MOVEABLE(InterruptEvent);
|
||||
private:
|
||||
InterruptEventType event;
|
||||
InterruptEventType m_event;
|
||||
public:
|
||||
explicit InterruptEvent(InterruptName name, EventClearMode clear_mode) {
|
||||
InitializeInterruptEvent(std::addressof(this->event), name, clear_mode);
|
||||
InitializeInterruptEvent(std::addressof(m_event), name, clear_mode);
|
||||
}
|
||||
|
||||
~InterruptEvent() {
|
||||
FinalizeInterruptEvent(std::addressof(this->event));
|
||||
FinalizeInterruptEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
void Wait() {
|
||||
return WaitInterruptEvent(std::addressof(this->event));
|
||||
return WaitInterruptEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
bool TryWait() {
|
||||
return TryWaitInterruptEvent(std::addressof(this->event));
|
||||
return TryWaitInterruptEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
bool TimedWait(TimeSpan timeout) {
|
||||
return TimedWaitInterruptEvent(std::addressof(this->event), timeout);
|
||||
return TimedWaitInterruptEvent(std::addressof(m_event), timeout);
|
||||
}
|
||||
|
||||
void Clear() {
|
||||
return ClearInterruptEvent(std::addressof(this->event));
|
||||
return ClearInterruptEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
operator InterruptEventType &() {
|
||||
return this->event;
|
||||
return m_event;
|
||||
}
|
||||
|
||||
operator const InterruptEventType &() const {
|
||||
return this->event;
|
||||
return m_event;
|
||||
}
|
||||
|
||||
InterruptEventType *GetBase() {
|
||||
return std::addressof(this->event);
|
||||
return std::addressof(m_event);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -25,76 +25,76 @@ namespace ams::os {
|
||||
NON_COPYABLE(MessageQueue);
|
||||
NON_MOVEABLE(MessageQueue);
|
||||
private:
|
||||
MessageQueueType mq;
|
||||
MessageQueueType m_mq;
|
||||
public:
|
||||
explicit MessageQueue(uintptr_t *buf, size_t count) {
|
||||
InitializeMessageQueue(std::addressof(this->mq), buf, count);
|
||||
InitializeMessageQueue(std::addressof(m_mq), buf, count);
|
||||
}
|
||||
|
||||
~MessageQueue() { FinalizeMessageQueue(std::addressof(this->mq)); }
|
||||
~MessageQueue() { FinalizeMessageQueue(std::addressof(m_mq)); }
|
||||
|
||||
/* Sending (FIFO functionality) */
|
||||
void Send(uintptr_t data) {
|
||||
return SendMessageQueue(std::addressof(this->mq), data);
|
||||
return SendMessageQueue(std::addressof(m_mq), data);
|
||||
}
|
||||
|
||||
bool TrySend(uintptr_t data) {
|
||||
return TrySendMessageQueue(std::addressof(this->mq), data);
|
||||
return TrySendMessageQueue(std::addressof(m_mq), data);
|
||||
}
|
||||
|
||||
bool TimedSend(uintptr_t data, TimeSpan timeout) {
|
||||
return TimedSendMessageQueue(std::addressof(this->mq), data, timeout);
|
||||
return TimedSendMessageQueue(std::addressof(m_mq), data, timeout);
|
||||
}
|
||||
|
||||
/* Jamming (LIFO functionality) */
|
||||
void Jam(uintptr_t data) {
|
||||
return JamMessageQueue(std::addressof(this->mq), data);
|
||||
return JamMessageQueue(std::addressof(m_mq), data);
|
||||
}
|
||||
|
||||
bool TryJam(uintptr_t data) {
|
||||
return TryJamMessageQueue(std::addressof(this->mq), data);
|
||||
return TryJamMessageQueue(std::addressof(m_mq), data);
|
||||
}
|
||||
|
||||
bool TimedJam(uintptr_t data, TimeSpan timeout) {
|
||||
return TimedJamMessageQueue(std::addressof(this->mq), data, timeout);
|
||||
return TimedJamMessageQueue(std::addressof(m_mq), data, timeout);
|
||||
}
|
||||
|
||||
/* Receive functionality */
|
||||
void Receive(uintptr_t *out) {
|
||||
return ReceiveMessageQueue(out, std::addressof(this->mq));
|
||||
return ReceiveMessageQueue(out, std::addressof(m_mq));
|
||||
}
|
||||
|
||||
bool TryReceive(uintptr_t *out) {
|
||||
return TryReceiveMessageQueue(out, std::addressof(this->mq));
|
||||
return TryReceiveMessageQueue(out, std::addressof(m_mq));
|
||||
}
|
||||
|
||||
bool TimedReceive(uintptr_t *out, TimeSpan timeout) {
|
||||
return TimedReceiveMessageQueue(out, std::addressof(this->mq), timeout);
|
||||
return TimedReceiveMessageQueue(out, std::addressof(m_mq), timeout);
|
||||
}
|
||||
|
||||
/* Peek functionality */
|
||||
void Peek(uintptr_t *out) const {
|
||||
return PeekMessageQueue(out, std::addressof(this->mq));
|
||||
return PeekMessageQueue(out, std::addressof(m_mq));
|
||||
}
|
||||
|
||||
bool TryPeek(uintptr_t *out) const {
|
||||
return TryPeekMessageQueue(out, std::addressof(this->mq));
|
||||
return TryPeekMessageQueue(out, std::addressof(m_mq));
|
||||
}
|
||||
|
||||
bool TimedPeek(uintptr_t *out, TimeSpan timeout) const {
|
||||
return TimedPeekMessageQueue(out, std::addressof(this->mq), timeout);
|
||||
return TimedPeekMessageQueue(out, std::addressof(m_mq), timeout);
|
||||
}
|
||||
|
||||
operator MessageQueueType &() {
|
||||
return this->mq;
|
||||
return m_mq;
|
||||
}
|
||||
|
||||
operator const MessageQueueType &() const {
|
||||
return this->mq;
|
||||
return m_mq;
|
||||
}
|
||||
|
||||
MessageQueueType *GetBase() {
|
||||
return std::addressof(this->mq);
|
||||
return std::addressof(m_mq);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -25,26 +25,26 @@ namespace ams::os {
|
||||
NON_COPYABLE(Mutex);
|
||||
NON_MOVEABLE(Mutex);
|
||||
private:
|
||||
MutexType mutex;
|
||||
MutexType m_mutex;
|
||||
public:
|
||||
constexpr explicit Mutex(bool recursive) : mutex{::ams::os::MutexType::State_Initialized, recursive, 0, 0, nullptr, {{0}}} { /* ... */ }
|
||||
constexpr explicit Mutex(bool recursive) : m_mutex{::ams::os::MutexType::State_Initialized, recursive, 0, 0, nullptr, {{0}}} { /* ... */ }
|
||||
|
||||
~Mutex() { FinalizeMutex(std::addressof(this->mutex)); }
|
||||
~Mutex() { FinalizeMutex(std::addressof(m_mutex)); }
|
||||
|
||||
void lock() {
|
||||
return LockMutex(std::addressof(this->mutex));
|
||||
return LockMutex(std::addressof(m_mutex));
|
||||
}
|
||||
|
||||
void unlock() {
|
||||
return UnlockMutex(std::addressof(this->mutex));
|
||||
return UnlockMutex(std::addressof(m_mutex));
|
||||
}
|
||||
|
||||
bool try_lock() {
|
||||
return TryLockMutex(std::addressof(this->mutex));
|
||||
return TryLockMutex(std::addressof(m_mutex));
|
||||
}
|
||||
|
||||
bool IsLockedByCurrentThread() const {
|
||||
return IsMutexLockedByCurrentThread(std::addressof(this->mutex));
|
||||
return IsMutexLockedByCurrentThread(std::addressof(m_mutex));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void Lock() {
|
||||
@@ -60,15 +60,15 @@ namespace ams::os {
|
||||
}
|
||||
|
||||
operator MutexType &() {
|
||||
return this->mutex;
|
||||
return m_mutex;
|
||||
}
|
||||
|
||||
operator const MutexType &() const {
|
||||
return this->mutex;
|
||||
return m_mutex;
|
||||
}
|
||||
|
||||
MutexType *GetBase() {
|
||||
return std::addressof(this->mutex);
|
||||
return std::addressof(m_mutex);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -25,46 +25,46 @@ namespace ams::os {
|
||||
NON_COPYABLE(ReaderWriterLock);
|
||||
NON_MOVEABLE(ReaderWriterLock);
|
||||
private:
|
||||
ReaderWriterLockType rw_lock;
|
||||
ReaderWriterLockType m_rw_lock;
|
||||
public:
|
||||
constexpr explicit ReaderWriterLock() : rw_lock{{}, 0, ::ams::os::ReaderWriterLockType::State_Initialized, nullptr, 0, {}, {}} { /* ... */ }
|
||||
constexpr explicit ReaderWriterLock() : m_rw_lock{{}, 0, ::ams::os::ReaderWriterLockType::State_Initialized, nullptr, 0, {}, {}} { /* ... */ }
|
||||
|
||||
~ReaderWriterLock() { os::FinalizeReaderWriterLock(std::addressof(this->rw_lock)); }
|
||||
~ReaderWriterLock() { os::FinalizeReaderWriterLock(std::addressof(m_rw_lock)); }
|
||||
|
||||
void AcquireReadLock() {
|
||||
return os::AcquireReadLock(std::addressof(this->rw_lock));
|
||||
return os::AcquireReadLock(std::addressof(m_rw_lock));
|
||||
}
|
||||
|
||||
bool TryAcquireReadLock() {
|
||||
return os::TryAcquireReadLock(std::addressof(this->rw_lock));
|
||||
return os::TryAcquireReadLock(std::addressof(m_rw_lock));
|
||||
}
|
||||
|
||||
void ReleaseReadLock() {
|
||||
return os::ReleaseReadLock(std::addressof(this->rw_lock));
|
||||
return os::ReleaseReadLock(std::addressof(m_rw_lock));
|
||||
}
|
||||
|
||||
void AcquireWriteLock() {
|
||||
return os::AcquireWriteLock(std::addressof(this->rw_lock));
|
||||
return os::AcquireWriteLock(std::addressof(m_rw_lock));
|
||||
}
|
||||
|
||||
bool TryAcquireWriteLock() {
|
||||
return os::TryAcquireWriteLock(std::addressof(this->rw_lock));
|
||||
return os::TryAcquireWriteLock(std::addressof(m_rw_lock));
|
||||
}
|
||||
|
||||
void ReleaseWriteLock() {
|
||||
return os::ReleaseWriteLock(std::addressof(this->rw_lock));
|
||||
return os::ReleaseWriteLock(std::addressof(m_rw_lock));
|
||||
}
|
||||
|
||||
bool IsReadLockHeld() const {
|
||||
return os::IsReadLockHeld(std::addressof(this->rw_lock));
|
||||
return os::IsReadLockHeld(std::addressof(m_rw_lock));
|
||||
}
|
||||
|
||||
bool IsWriteLockHeldByCurrentThread() const {
|
||||
return os::IsWriteLockHeldByCurrentThread(std::addressof(this->rw_lock));
|
||||
return os::IsWriteLockHeldByCurrentThread(std::addressof(m_rw_lock));
|
||||
}
|
||||
|
||||
bool IsLockOwner() const {
|
||||
return os::IsReaderWriterLockOwnerThread(std::addressof(this->rw_lock));
|
||||
return os::IsReaderWriterLockOwnerThread(std::addressof(m_rw_lock));
|
||||
}
|
||||
|
||||
void lock_shared() {
|
||||
@@ -92,15 +92,15 @@ namespace ams::os {
|
||||
}
|
||||
|
||||
operator ReaderWriterLockType &() {
|
||||
return this->rw_lock;
|
||||
return m_rw_lock;
|
||||
}
|
||||
|
||||
operator const ReaderWriterLockType &() const {
|
||||
return this->rw_lock;
|
||||
return m_rw_lock;
|
||||
}
|
||||
|
||||
ReaderWriterLockType *GetBase() {
|
||||
return std::addressof(this->rw_lock);
|
||||
return std::addressof(m_rw_lock);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -24,24 +24,24 @@ namespace ams::os {
|
||||
NON_COPYABLE(SdkThreadLocalStorage);
|
||||
NON_MOVEABLE(SdkThreadLocalStorage);
|
||||
private:
|
||||
TlsSlot tls_slot;
|
||||
TlsSlot m_tls_slot;
|
||||
public:
|
||||
SdkThreadLocalStorage() {
|
||||
R_ABORT_UNLESS(os::SdkAllocateTlsSlot(std::addressof(this->tls_slot), nullptr));
|
||||
R_ABORT_UNLESS(os::SdkAllocateTlsSlot(std::addressof(m_tls_slot), nullptr));
|
||||
}
|
||||
|
||||
explicit SdkThreadLocalStorage(TlsDestructor destructor) {
|
||||
R_ABORT_UNLESS(os::SdkAllocateTlsSlot(std::addressof(this->tls_slot), destructor));
|
||||
R_ABORT_UNLESS(os::SdkAllocateTlsSlot(std::addressof(m_tls_slot), destructor));
|
||||
}
|
||||
|
||||
~SdkThreadLocalStorage() {
|
||||
os::FreeTlsSlot(this->tls_slot);
|
||||
os::FreeTlsSlot(m_tls_slot);
|
||||
}
|
||||
|
||||
uintptr_t GetValue() const { return os::GetTlsValue(this->tls_slot); }
|
||||
void SetValue(uintptr_t value) { return os::SetTlsValue(this->tls_slot, value); }
|
||||
uintptr_t GetValue() const { return os::GetTlsValue(m_tls_slot); }
|
||||
void SetValue(uintptr_t value) { return os::SetTlsValue(m_tls_slot, value); }
|
||||
|
||||
TlsSlot GetTlsSlot() const { return this->tls_slot; }
|
||||
TlsSlot GetTlsSlot() const { return m_tls_slot; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -23,48 +23,48 @@ namespace ams::os {
|
||||
NON_COPYABLE(Semaphore);
|
||||
NON_MOVEABLE(Semaphore);
|
||||
private:
|
||||
SemaphoreType sema;
|
||||
SemaphoreType m_sema;
|
||||
public:
|
||||
explicit Semaphore(s32 count, s32 max_count) {
|
||||
InitializeSemaphore(std::addressof(this->sema), count, max_count);
|
||||
InitializeSemaphore(std::addressof(m_sema), count, max_count);
|
||||
}
|
||||
|
||||
~Semaphore() { FinalizeSemaphore(std::addressof(this->sema)); }
|
||||
~Semaphore() { FinalizeSemaphore(std::addressof(m_sema)); }
|
||||
|
||||
void Acquire() {
|
||||
return os::AcquireSemaphore(std::addressof(this->sema));
|
||||
return os::AcquireSemaphore(std::addressof(m_sema));
|
||||
}
|
||||
|
||||
bool TryAcquire() {
|
||||
return os::TryAcquireSemaphore(std::addressof(this->sema));
|
||||
return os::TryAcquireSemaphore(std::addressof(m_sema));
|
||||
}
|
||||
|
||||
bool TimedAcquire(TimeSpan timeout) {
|
||||
return os::TimedAcquireSemaphore(std::addressof(this->sema), timeout);
|
||||
return os::TimedAcquireSemaphore(std::addressof(m_sema), timeout);
|
||||
}
|
||||
|
||||
void Release() {
|
||||
return os::ReleaseSemaphore(std::addressof(this->sema));
|
||||
return os::ReleaseSemaphore(std::addressof(m_sema));
|
||||
}
|
||||
|
||||
void Release(s32 count) {
|
||||
return os::ReleaseSemaphore(std::addressof(this->sema), count);
|
||||
return os::ReleaseSemaphore(std::addressof(m_sema), count);
|
||||
}
|
||||
|
||||
s32 GetCurrentCount() const {
|
||||
return os::GetCurrentSemaphoreCount(std::addressof(this->sema));
|
||||
return os::GetCurrentSemaphoreCount(std::addressof(m_sema));
|
||||
}
|
||||
|
||||
operator SemaphoreType &() {
|
||||
return this->sema;
|
||||
return m_sema;
|
||||
}
|
||||
|
||||
operator const SemaphoreType &() const {
|
||||
return this->sema;
|
||||
return m_sema;
|
||||
}
|
||||
|
||||
SemaphoreType *GetBase() {
|
||||
return std::addressof(this->sema);
|
||||
return std::addressof(m_sema);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -25,88 +25,88 @@ namespace ams::os {
|
||||
NON_COPYABLE(SystemEvent);
|
||||
NON_MOVEABLE(SystemEvent);
|
||||
private:
|
||||
SystemEventType system_event;
|
||||
SystemEventType m_system_event;
|
||||
public:
|
||||
SystemEvent() {
|
||||
this->system_event.state = SystemEventType::State_NotInitialized;
|
||||
m_system_event.state = SystemEventType::State_NotInitialized;
|
||||
}
|
||||
|
||||
explicit SystemEvent(EventClearMode clear_mode, bool inter_process) {
|
||||
R_ABORT_UNLESS(CreateSystemEvent(std::addressof(this->system_event), clear_mode, inter_process));
|
||||
R_ABORT_UNLESS(CreateSystemEvent(std::addressof(m_system_event), clear_mode, inter_process));
|
||||
}
|
||||
|
||||
explicit SystemEvent(NativeHandle read_handle, bool manage_read_handle, NativeHandle write_handle, bool manage_write_handle, EventClearMode clear_mode) {
|
||||
AttachSystemEvent(std::addressof(this->system_event), read_handle, manage_read_handle, write_handle, manage_write_handle, clear_mode);
|
||||
AttachSystemEvent(std::addressof(m_system_event), read_handle, manage_read_handle, write_handle, manage_write_handle, clear_mode);
|
||||
}
|
||||
|
||||
~SystemEvent() {
|
||||
if (this->system_event.state == SystemEventType::State_NotInitialized) {
|
||||
if (m_system_event.state == SystemEventType::State_NotInitialized) {
|
||||
return;
|
||||
}
|
||||
DestroySystemEvent(std::addressof(this->system_event));
|
||||
DestroySystemEvent(std::addressof(m_system_event));
|
||||
}
|
||||
|
||||
void Attach(NativeHandle read_handle, bool manage_read_handle, NativeHandle write_handle, bool manage_write_handle, EventClearMode clear_mode) {
|
||||
AMS_ABORT_UNLESS(this->system_event.state == SystemEventType::State_NotInitialized);
|
||||
return AttachSystemEvent(std::addressof(this->system_event), read_handle, manage_read_handle, write_handle, manage_write_handle, clear_mode);
|
||||
AMS_ABORT_UNLESS(m_system_event.state == SystemEventType::State_NotInitialized);
|
||||
return AttachSystemEvent(std::addressof(m_system_event), read_handle, manage_read_handle, write_handle, manage_write_handle, clear_mode);
|
||||
}
|
||||
|
||||
void AttachReadableHandle(NativeHandle read_handle, bool manage_read_handle, EventClearMode clear_mode) {
|
||||
AMS_ABORT_UNLESS(this->system_event.state == SystemEventType::State_NotInitialized);
|
||||
return AttachReadableHandleToSystemEvent(std::addressof(this->system_event), read_handle, manage_read_handle, clear_mode);
|
||||
AMS_ABORT_UNLESS(m_system_event.state == SystemEventType::State_NotInitialized);
|
||||
return AttachReadableHandleToSystemEvent(std::addressof(m_system_event), read_handle, manage_read_handle, clear_mode);
|
||||
}
|
||||
|
||||
void AttachWritableHandle(NativeHandle write_handle, bool manage_write_handle, EventClearMode clear_mode) {
|
||||
AMS_ABORT_UNLESS(this->system_event.state == SystemEventType::State_NotInitialized);
|
||||
return AttachWritableHandleToSystemEvent(std::addressof(this->system_event), write_handle, manage_write_handle, clear_mode);
|
||||
AMS_ABORT_UNLESS(m_system_event.state == SystemEventType::State_NotInitialized);
|
||||
return AttachWritableHandleToSystemEvent(std::addressof(m_system_event), write_handle, manage_write_handle, clear_mode);
|
||||
}
|
||||
|
||||
NativeHandle DetachReadableHandle() {
|
||||
return DetachReadableHandleOfSystemEvent(std::addressof(this->system_event));
|
||||
return DetachReadableHandleOfSystemEvent(std::addressof(m_system_event));
|
||||
}
|
||||
|
||||
NativeHandle DetachWritableHandle() {
|
||||
return DetachWritableHandleOfSystemEvent(std::addressof(this->system_event));
|
||||
return DetachWritableHandleOfSystemEvent(std::addressof(m_system_event));
|
||||
}
|
||||
|
||||
void Wait() {
|
||||
return WaitSystemEvent(std::addressof(this->system_event));
|
||||
return WaitSystemEvent(std::addressof(m_system_event));
|
||||
}
|
||||
|
||||
bool TryWait() {
|
||||
return TryWaitSystemEvent(std::addressof(this->system_event));
|
||||
return TryWaitSystemEvent(std::addressof(m_system_event));
|
||||
}
|
||||
|
||||
bool TimedWait(TimeSpan timeout) {
|
||||
return TimedWaitSystemEvent(std::addressof(this->system_event), timeout);
|
||||
return TimedWaitSystemEvent(std::addressof(m_system_event), timeout);
|
||||
}
|
||||
|
||||
void Signal() {
|
||||
return SignalSystemEvent(std::addressof(this->system_event));
|
||||
return SignalSystemEvent(std::addressof(m_system_event));
|
||||
}
|
||||
|
||||
void Clear() {
|
||||
return ClearSystemEvent(std::addressof(this->system_event));
|
||||
return ClearSystemEvent(std::addressof(m_system_event));
|
||||
}
|
||||
|
||||
NativeHandle GetReadableHandle() const {
|
||||
return GetReadableHandleOfSystemEvent(std::addressof(this->system_event));
|
||||
return GetReadableHandleOfSystemEvent(std::addressof(m_system_event));
|
||||
}
|
||||
|
||||
NativeHandle GetWritableHandle() const {
|
||||
return GetWritableHandleOfSystemEvent(std::addressof(this->system_event));
|
||||
return GetWritableHandleOfSystemEvent(std::addressof(m_system_event));
|
||||
}
|
||||
|
||||
operator SystemEventType &() {
|
||||
return this->system_event;
|
||||
return m_system_event;
|
||||
}
|
||||
|
||||
operator const SystemEventType &() const {
|
||||
return this->system_event;
|
||||
return m_system_event;
|
||||
}
|
||||
|
||||
SystemEventType *GetBase() {
|
||||
return std::addressof(this->system_event);
|
||||
return std::addressof(m_system_event);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -24,24 +24,24 @@ namespace ams::os {
|
||||
NON_COPYABLE(ThreadLocalStorage);
|
||||
NON_MOVEABLE(ThreadLocalStorage);
|
||||
private:
|
||||
TlsSlot tls_slot;
|
||||
TlsSlot m_tls_slot;
|
||||
public:
|
||||
ThreadLocalStorage() {
|
||||
R_ABORT_UNLESS(os::AllocateTlsSlot(std::addressof(this->tls_slot), nullptr));
|
||||
R_ABORT_UNLESS(os::AllocateTlsSlot(std::addressof(m_tls_slot), nullptr));
|
||||
}
|
||||
|
||||
explicit ThreadLocalStorage(TlsDestructor destructor) {
|
||||
R_ABORT_UNLESS(os::AllocateTlsSlot(std::addressof(this->tls_slot), destructor));
|
||||
R_ABORT_UNLESS(os::AllocateTlsSlot(std::addressof(m_tls_slot), destructor));
|
||||
}
|
||||
|
||||
~ThreadLocalStorage() {
|
||||
os::FreeTlsSlot(this->tls_slot);
|
||||
os::FreeTlsSlot(m_tls_slot);
|
||||
}
|
||||
|
||||
uintptr_t GetValue() const { return os::GetTlsValue(this->tls_slot); }
|
||||
void SetValue(uintptr_t value) { return os::SetTlsValue(this->tls_slot, value); }
|
||||
uintptr_t GetValue() const { return os::GetTlsValue(m_tls_slot); }
|
||||
void SetValue(uintptr_t value) { return os::SetTlsValue(m_tls_slot, value); }
|
||||
|
||||
TlsSlot GetTlsSlot() const { return this->tls_slot; }
|
||||
TlsSlot GetTlsSlot() const { return m_tls_slot; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -29,22 +29,22 @@ namespace ams::os {
|
||||
|
||||
class Tick {
|
||||
private:
|
||||
s64 tick;
|
||||
s64 m_tick;
|
||||
public:
|
||||
constexpr explicit Tick(s64 t = 0) : tick(t) { /* ... */ }
|
||||
Tick(TimeSpan ts) : tick(ConvertToTick(ts).GetInt64Value()) { /* ... */ }
|
||||
constexpr explicit Tick(s64 t = 0) : m_tick(t) { /* ... */ }
|
||||
Tick(TimeSpan ts) : m_tick(ConvertToTick(ts).GetInt64Value()) { /* ... */ }
|
||||
public:
|
||||
constexpr s64 GetInt64Value() const { return this->tick; }
|
||||
constexpr s64 GetInt64Value() const { return m_tick; }
|
||||
TimeSpan ToTimeSpan() const { return ConvertToTimeSpan(*this); }
|
||||
|
||||
/* Tick arithmetic. */
|
||||
constexpr Tick &operator+=(Tick rhs) { this->tick += rhs.tick; return *this; }
|
||||
constexpr Tick &operator-=(Tick rhs) { this->tick -= rhs.tick; return *this; }
|
||||
constexpr Tick &operator+=(Tick rhs) { m_tick += rhs.m_tick; return *this; }
|
||||
constexpr Tick &operator-=(Tick rhs) { m_tick -= rhs.m_tick; return *this; }
|
||||
constexpr Tick operator+(Tick rhs) const { Tick r(*this); return r += rhs; }
|
||||
constexpr Tick operator-(Tick rhs) const { Tick r(*this); return r -= rhs; }
|
||||
|
||||
constexpr bool operator==(const Tick &rhs) const {
|
||||
return this->tick == rhs.tick;
|
||||
return m_tick == rhs.m_tick;
|
||||
}
|
||||
|
||||
constexpr bool operator!=(const Tick &rhs) const {
|
||||
@@ -52,7 +52,7 @@ namespace ams::os {
|
||||
}
|
||||
|
||||
constexpr bool operator<(const Tick &rhs) const {
|
||||
return this->tick < rhs.tick;
|
||||
return m_tick < rhs.m_tick;
|
||||
}
|
||||
|
||||
constexpr bool operator>=(const Tick &rhs) const {
|
||||
@@ -60,7 +60,7 @@ namespace ams::os {
|
||||
}
|
||||
|
||||
constexpr bool operator>(const Tick &rhs) const {
|
||||
return this->tick > rhs.tick;
|
||||
return m_tick > rhs.m_tick;
|
||||
}
|
||||
|
||||
constexpr bool operator<=(const Tick &rhs) const {
|
||||
|
||||
@@ -25,54 +25,54 @@ namespace ams::os {
|
||||
NON_COPYABLE(TimerEvent);
|
||||
NON_MOVEABLE(TimerEvent);
|
||||
private:
|
||||
TimerEventType event;
|
||||
TimerEventType m_event;
|
||||
public:
|
||||
explicit TimerEvent(EventClearMode clear_mode) {
|
||||
InitializeTimerEvent(std::addressof(this->event), clear_mode);
|
||||
InitializeTimerEvent(std::addressof(m_event), clear_mode);
|
||||
}
|
||||
|
||||
~TimerEvent() {
|
||||
FinalizeTimerEvent(std::addressof(this->event));
|
||||
FinalizeTimerEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
void StartOneShot(TimeSpan first_time) {
|
||||
return StartOneShotTimerEvent(std::addressof(this->event), first_time);
|
||||
return StartOneShotTimerEvent(std::addressof(m_event), first_time);
|
||||
}
|
||||
|
||||
void StartPeriodic(TimeSpan first_time, TimeSpan interval) {
|
||||
return StartPeriodicTimerEvent(std::addressof(this->event), first_time, interval);
|
||||
return StartPeriodicTimerEvent(std::addressof(m_event), first_time, interval);
|
||||
}
|
||||
|
||||
void Stop() {
|
||||
return StopTimerEvent(std::addressof(this->event));
|
||||
return StopTimerEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
void Wait() {
|
||||
return WaitTimerEvent(std::addressof(this->event));
|
||||
return WaitTimerEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
bool TryWait() {
|
||||
return TryWaitTimerEvent(std::addressof(this->event));
|
||||
return TryWaitTimerEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
void Signal() {
|
||||
return SignalTimerEvent(std::addressof(this->event));
|
||||
return SignalTimerEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
void Clear() {
|
||||
return ClearTimerEvent(std::addressof(this->event));
|
||||
return ClearTimerEvent(std::addressof(m_event));
|
||||
}
|
||||
|
||||
operator TimerEventType &() {
|
||||
return this->event;
|
||||
return m_event;
|
||||
}
|
||||
|
||||
operator const TimerEventType &() const {
|
||||
return this->event;
|
||||
return m_event;
|
||||
}
|
||||
|
||||
TimerEventType *GetBase() {
|
||||
return std::addressof(this->event);
|
||||
return std::addressof(m_event);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -25,14 +25,14 @@ namespace ams::os {
|
||||
NON_COPYABLE(TransferMemory);
|
||||
NON_MOVEABLE(TransferMemory);
|
||||
private:
|
||||
TransferMemoryType tmem;
|
||||
TransferMemoryType m_tmem;
|
||||
public:
|
||||
constexpr TransferMemory() : tmem{ .state = TransferMemoryType::State_NotInitialized } {
|
||||
constexpr TransferMemory() : m_tmem{ .state = TransferMemoryType::State_NotInitialized } {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
TransferMemory(void *address, size_t size, MemoryPermission perm) {
|
||||
R_ABORT_UNLESS(CreateTransferMemory(std::addressof(this->tmem), address, size, perm));
|
||||
R_ABORT_UNLESS(CreateTransferMemory(std::addressof(m_tmem), address, size, perm));
|
||||
}
|
||||
|
||||
TransferMemory(size_t size, NativeHandle handle, bool managed) {
|
||||
@@ -40,38 +40,38 @@ namespace ams::os {
|
||||
}
|
||||
|
||||
~TransferMemory() {
|
||||
if (this->tmem.state == TransferMemoryType::State_NotInitialized) {
|
||||
if (m_tmem.state == TransferMemoryType::State_NotInitialized) {
|
||||
return;
|
||||
}
|
||||
DestroyTransferMemory(std::addressof(this->tmem));
|
||||
DestroyTransferMemory(std::addressof(m_tmem));
|
||||
}
|
||||
|
||||
void Attach(size_t size, NativeHandle handle, bool managed) {
|
||||
AttachTransferMemory(std::addressof(this->tmem), size, handle, managed);
|
||||
AttachTransferMemory(std::addressof(m_tmem), size, handle, managed);
|
||||
}
|
||||
|
||||
NativeHandle Detach() {
|
||||
return DetachTransferMemory(std::addressof(this->tmem));
|
||||
return DetachTransferMemory(std::addressof(m_tmem));
|
||||
}
|
||||
|
||||
Result Map(void **out, MemoryPermission owner_perm) {
|
||||
return MapTransferMemory(out, std::addressof(this->tmem), owner_perm);
|
||||
return MapTransferMemory(out, std::addressof(m_tmem), owner_perm);
|
||||
}
|
||||
|
||||
void Unmap() {
|
||||
UnmapTransferMemory(std::addressof(this->tmem));
|
||||
UnmapTransferMemory(std::addressof(m_tmem));
|
||||
}
|
||||
|
||||
operator TransferMemoryType &() {
|
||||
return this->tmem;
|
||||
return m_tmem;
|
||||
}
|
||||
|
||||
operator const TransferMemoryType &() const {
|
||||
return this->tmem;
|
||||
return m_tmem;
|
||||
}
|
||||
|
||||
TransferMemoryType *GetBase() {
|
||||
return std::addressof(this->tmem);
|
||||
return std::addressof(m_tmem);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user