ams: revamp assertion system

This commit is contained in:
Michael Scire
2020-02-22 23:05:14 -08:00
parent 9572fb2ce3
commit 40400aee1f
168 changed files with 1014 additions and 696 deletions

View File

@@ -50,7 +50,7 @@ namespace ams::os {
NX_INLINE os::ProcessId GetProcessId(::Handle process_handle) {
os::ProcessId process_id;
R_ASSERT(TryGetProcessId(&process_id, process_handle));
R_ABORT_UNLESS(TryGetProcessId(&process_id, process_handle));
return process_id;
}

View File

@@ -47,7 +47,7 @@ namespace ams::os {
}
void Wait(::Mutex *m) {
R_ASSERT(condvarWait(&this->cv, m));
R_ABORT_UNLESS(condvarWait(&this->cv, m));
}
ConditionVariableStatus TimedWait(os::Mutex *m, u64 timeout) {

View File

@@ -28,7 +28,7 @@ namespace ams::os {
ManagedHandle(Handle h) : hnd(h) { /* ... */ }
~ManagedHandle() {
if (this->hnd != INVALID_HANDLE) {
R_ASSERT(svcCloseHandle(this->hnd));
R_ABORT_UNLESS(svcCloseHandle(this->hnd));
this->hnd = INVALID_HANDLE;
}
}

View File

@@ -71,7 +71,7 @@ namespace ams::os {
constexpr StaticThread() : stack_mem{}, thr{} { /* ... */ }
constexpr StaticThread(ThreadFunc entry, void *arg, int prio, int cpuid = -2) : StaticThread() {
R_ASSERT(this->Initialize(entry, arg, prio, cpuid));
R_ABORT_UNLESS(this->Initialize(entry, arg, prio, cpuid));
}
Result Initialize(ThreadFunc entry, void *arg, int prio, int cpuid = -2) {
@@ -103,7 +103,7 @@ namespace ams::os {
NX_INLINE u32 GetCurrentThreadPriority() {
u32 prio;
R_ASSERT(svcGetThreadPriority(&prio, CUR_THREAD_HANDLE));
R_ABORT_UNLESS(svcGetThreadPriority(&prio, CUR_THREAD_HANDLE));
return prio;
}