[Base] Check success of sync primitive creation

- Mainly use `assert`s, since failure is very rare
- Forward failure of `CreateSemaphore` to guests because it is more easy
  to trigger with invalid initial parameters.
This commit is contained in:
Joel Linn
2022-02-24 22:37:32 +01:00
committed by Rick Gibbed
parent 6bd1279fc0
commit 986dcf4f65
21 changed files with 96 additions and 26 deletions

View File

@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Copyright 2022 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -30,6 +30,7 @@ void XEvent::Initialize(bool manual_reset, bool initial_state) {
} else {
event_ = xe::threading::Event::CreateAutoResetEvent(initial_state);
}
assert_not_null(event_);
}
void XEvent::InitializeNative(void* native_ptr, X_DISPATCH_HEADER* header) {
@@ -53,6 +54,7 @@ void XEvent::InitializeNative(void* native_ptr, X_DISPATCH_HEADER* header) {
} else {
event_ = xe::threading::Event::CreateAutoResetEvent(initial_state);
}
assert_not_null(event_);
}
int32_t XEvent::Set(uint32_t priority_increment, bool wait) {
@@ -112,6 +114,7 @@ object_ref<XEvent> XEvent::Restore(KernelState* kernel_state,
} else {
evt->event_ = xe::threading::Event::CreateAutoResetEvent(false);
}
assert_not_null(evt->event_);
if (signaled) {
evt->event_->Set();