kernel: Update to use atmosphere macros and correct Result (#7242)

* kernel: Switch to atmosphere style macros

* code: Rename ResultCode to Result

* code: Result constants are lower case

* Address review comments

* core: Remove CASCADE_CODE

* R_TRY replaces completely

* core: Run clang format
This commit is contained in:
GPUCode
2023-12-31 19:01:40 +02:00
committed by GitHub
parent 811303ea54
commit 5a7f615da1
132 changed files with 2807 additions and 2995 deletions

View File

@ -66,7 +66,7 @@ void Mutex::Acquire(Thread* thread) {
lock_count++;
}
ResultCode Mutex::Release(Thread* thread) {
Result Mutex::Release(Thread* thread) {
// We can only release the mutex if it's held by the calling thread.
if (thread != holding_thread.get()) {
if (holding_thread) {
@ -75,15 +75,15 @@ ResultCode Mutex::Release(Thread* thread) {
"Tried to release a mutex (owned by thread id {}) from a different thread id {}",
holding_thread->thread_id, thread->thread_id);
}
return ResultCode(ErrCodes::WrongLockingThread, ErrorModule::Kernel,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
return Result(ErrCodes::WrongLockingThread, ErrorModule::Kernel,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
}
// Note: It should not be possible for the situation where the mutex has a holding thread with a
// zero lock count to occur. The real kernel still checks for this, so we do too.
if (lock_count <= 0)
return ResultCode(ErrorDescription::InvalidResultValue, ErrorModule::Kernel,
ErrorSummary::InvalidState, ErrorLevel::Permanent);
return Result(ErrorDescription::InvalidResultValue, ErrorModule::Kernel,
ErrorSummary::InvalidState, ErrorLevel::Permanent);
lock_count--;
@ -96,7 +96,7 @@ ResultCode Mutex::Release(Thread* thread) {
kernel.PrepareReschedule();
}
return RESULT_SUCCESS;
return ResultSuccess;
}
void Mutex::AddWaitingThread(std::shared_ptr<Thread> thread) {