ams: support building unit test programs on windows/linux/macos
This commit is contained in:
@@ -23,9 +23,13 @@ namespace ams::os {
|
||||
class SdkConditionVariable;
|
||||
|
||||
struct SdkRecursiveMutexType {
|
||||
#if !defined(AMS_OS_INTERNAL_CRITICAL_SECTION_IMPL_CAN_CHECK_LOCKED_BY_CURRENT_THREAD)
|
||||
os::ThreadType *owner_thread;
|
||||
#endif
|
||||
union {
|
||||
s32 _arr[sizeof(impl::InternalCriticalSectionStorage) / sizeof(s32)];
|
||||
impl::InternalCriticalSectionStorage _storage;
|
||||
impl::InternalCriticalSectionStorageTypeForConstantInitialize _storage_for_constant_initialize;
|
||||
};
|
||||
u32 recursive_count;
|
||||
};
|
||||
@@ -45,7 +49,11 @@ namespace ams::os {
|
||||
private:
|
||||
SdkRecursiveMutexType m_mutex;
|
||||
public:
|
||||
constexpr SdkRecursiveMutex() : m_mutex{{0}, 0} { /* ... */ }
|
||||
#if defined(AMS_OS_INTERNAL_CRITICAL_SECTION_IMPL_CAN_CHECK_LOCKED_BY_CURRENT_THREAD)
|
||||
constexpr SdkRecursiveMutex() : m_mutex{ { AMS_OS_INTERNAL_CRITICAL_SECTION_IMPL_CONSTANT_INITIALIZER }, 0 } { /* ... */ }
|
||||
#else
|
||||
constexpr SdkRecursiveMutex() : m_mutex{ nullptr, { AMS_OS_INTERNAL_CRITICAL_SECTION_IMPL_CONSTANT_INITIALIZER }, 0 } { /* ... */ }
|
||||
#endif
|
||||
|
||||
ALWAYS_INLINE void Lock() { return os::LockSdkRecursiveMutex(std::addressof(m_mutex)); }
|
||||
ALWAYS_INLINE bool TryLock() { return os::TryLockSdkRecursiveMutex(std::addressof(m_mutex)); }
|
||||
|
||||
Reference in New Issue
Block a user