diff options
| author | 2022-10-14 17:30:38 -0400 | |
|---|---|---|
| committer | 2022-10-14 17:30:38 -0400 | |
| commit | ae6dd1143c0549fe5bcbd7326c69cbcb6b5a4433 (patch) | |
| tree | 4b04503746cd43789b1a812756974e38868be4cc /src/core/hle/kernel/svc.cpp | |
| parent | Merge pull request #9055 from liamwhite/hbl (diff) | |
| parent | kernel: remove KWritableEvent (diff) | |
| download | yuzu-ae6dd1143c0549fe5bcbd7326c69cbcb6b5a4433.tar.gz yuzu-ae6dd1143c0549fe5bcbd7326c69cbcb6b5a4433.tar.xz yuzu-ae6dd1143c0549fe5bcbd7326c69cbcb6b5a4433.zip | |
Merge pull request #9061 from liamwhite/writable-event
kernel: remove KWritableEvent
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 510a9b3e3..1d145ea91 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -35,7 +35,6 @@ | |||
| 35 | #include "core/hle/kernel/k_thread.h" | 35 | #include "core/hle/kernel/k_thread.h" |
| 36 | #include "core/hle/kernel/k_thread_queue.h" | 36 | #include "core/hle/kernel/k_thread_queue.h" |
| 37 | #include "core/hle/kernel/k_transfer_memory.h" | 37 | #include "core/hle/kernel/k_transfer_memory.h" |
| 38 | #include "core/hle/kernel/k_writable_event.h" | ||
| 39 | #include "core/hle/kernel/kernel.h" | 38 | #include "core/hle/kernel/kernel.h" |
| 40 | #include "core/hle/kernel/physical_core.h" | 39 | #include "core/hle/kernel/physical_core.h" |
| 41 | #include "core/hle/kernel/svc.h" | 40 | #include "core/hle/kernel/svc.h" |
| @@ -2445,11 +2444,11 @@ static Result SignalEvent(Core::System& system, Handle event_handle) { | |||
| 2445 | // Get the current handle table. | 2444 | // Get the current handle table. |
| 2446 | const KHandleTable& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); | 2445 | const KHandleTable& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); |
| 2447 | 2446 | ||
| 2448 | // Get the writable event. | 2447 | // Get the event. |
| 2449 | KScopedAutoObject writable_event = handle_table.GetObject<KWritableEvent>(event_handle); | 2448 | KScopedAutoObject event = handle_table.GetObject<KEvent>(event_handle); |
| 2450 | R_UNLESS(writable_event.IsNotNull(), ResultInvalidHandle); | 2449 | R_UNLESS(event.IsNotNull(), ResultInvalidHandle); |
| 2451 | 2450 | ||
| 2452 | return writable_event->Signal(); | 2451 | return event->Signal(); |
| 2453 | } | 2452 | } |
| 2454 | 2453 | ||
| 2455 | static Result SignalEvent32(Core::System& system, Handle event_handle) { | 2454 | static Result SignalEvent32(Core::System& system, Handle event_handle) { |
| @@ -2464,9 +2463,9 @@ static Result ClearEvent(Core::System& system, Handle event_handle) { | |||
| 2464 | 2463 | ||
| 2465 | // Try to clear the writable event. | 2464 | // Try to clear the writable event. |
| 2466 | { | 2465 | { |
| 2467 | KScopedAutoObject writable_event = handle_table.GetObject<KWritableEvent>(event_handle); | 2466 | KScopedAutoObject event = handle_table.GetObject<KEvent>(event_handle); |
| 2468 | if (writable_event.IsNotNull()) { | 2467 | if (event.IsNotNull()) { |
| 2469 | return writable_event->Clear(); | 2468 | return event->Clear(); |
| 2470 | } | 2469 | } |
| 2471 | } | 2470 | } |
| 2472 | 2471 | ||
| @@ -2504,24 +2503,24 @@ static Result CreateEvent(Core::System& system, Handle* out_write, Handle* out_r | |||
| 2504 | R_UNLESS(event != nullptr, ResultOutOfResource); | 2503 | R_UNLESS(event != nullptr, ResultOutOfResource); |
| 2505 | 2504 | ||
| 2506 | // Initialize the event. | 2505 | // Initialize the event. |
| 2507 | event->Initialize("CreateEvent", kernel.CurrentProcess()); | 2506 | event->Initialize(kernel.CurrentProcess()); |
| 2508 | 2507 | ||
| 2509 | // Commit the thread reservation. | 2508 | // Commit the thread reservation. |
| 2510 | event_reservation.Commit(); | 2509 | event_reservation.Commit(); |
| 2511 | 2510 | ||
| 2512 | // Ensure that we clean up the event (and its only references are handle table) on function end. | 2511 | // Ensure that we clean up the event (and its only references are handle table) on function end. |
| 2513 | SCOPE_EXIT({ | 2512 | SCOPE_EXIT({ |
| 2514 | event->GetWritableEvent().Close(); | ||
| 2515 | event->GetReadableEvent().Close(); | 2513 | event->GetReadableEvent().Close(); |
| 2514 | event->Close(); | ||
| 2516 | }); | 2515 | }); |
| 2517 | 2516 | ||
| 2518 | // Register the event. | 2517 | // Register the event. |
| 2519 | KEvent::Register(kernel, event); | 2518 | KEvent::Register(kernel, event); |
| 2520 | 2519 | ||
| 2521 | // Add the writable event to the handle table. | 2520 | // Add the event to the handle table. |
| 2522 | R_TRY(handle_table.Add(out_write, std::addressof(event->GetWritableEvent()))); | 2521 | R_TRY(handle_table.Add(out_write, event)); |
| 2523 | 2522 | ||
| 2524 | // Add the writable event to the handle table. | 2523 | // Ensure that we maintaing a clean handle state on exit. |
| 2525 | auto handle_guard = SCOPE_GUARD({ handle_table.Remove(*out_write); }); | 2524 | auto handle_guard = SCOPE_GUARD({ handle_table.Remove(*out_write); }); |
| 2526 | 2525 | ||
| 2527 | // Add the readable event to the handle table. | 2526 | // Add the readable event to the handle table. |