diff options
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 27e5a805d..035607daf 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | #include "core/hle/kernel/k_thread.h" | 34 | #include "core/hle/kernel/k_thread.h" |
| 35 | #include "core/hle/kernel/k_thread_queue.h" | 35 | #include "core/hle/kernel/k_thread_queue.h" |
| 36 | #include "core/hle/kernel/k_transfer_memory.h" | 36 | #include "core/hle/kernel/k_transfer_memory.h" |
| 37 | #include "core/hle/kernel/k_writable_event.h" | ||
| 38 | #include "core/hle/kernel/kernel.h" | 37 | #include "core/hle/kernel/kernel.h" |
| 39 | #include "core/hle/kernel/physical_core.h" | 38 | #include "core/hle/kernel/physical_core.h" |
| 40 | #include "core/hle/kernel/svc.h" | 39 | #include "core/hle/kernel/svc.h" |
| @@ -2303,11 +2302,11 @@ static Result SignalEvent(Core::System& system, Handle event_handle) { | |||
| 2303 | // Get the current handle table. | 2302 | // Get the current handle table. |
| 2304 | const KHandleTable& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); | 2303 | const KHandleTable& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); |
| 2305 | 2304 | ||
| 2306 | // Get the writable event. | 2305 | // Get the event. |
| 2307 | KScopedAutoObject writable_event = handle_table.GetObject<KWritableEvent>(event_handle); | 2306 | KScopedAutoObject event = handle_table.GetObject<KEvent>(event_handle); |
| 2308 | R_UNLESS(writable_event.IsNotNull(), ResultInvalidHandle); | 2307 | R_UNLESS(event.IsNotNull(), ResultInvalidHandle); |
| 2309 | 2308 | ||
| 2310 | return writable_event->Signal(); | 2309 | return event->Signal(); |
| 2311 | } | 2310 | } |
| 2312 | 2311 | ||
| 2313 | static Result SignalEvent32(Core::System& system, Handle event_handle) { | 2312 | static Result SignalEvent32(Core::System& system, Handle event_handle) { |
| @@ -2322,9 +2321,9 @@ static Result ClearEvent(Core::System& system, Handle event_handle) { | |||
| 2322 | 2321 | ||
| 2323 | // Try to clear the writable event. | 2322 | // Try to clear the writable event. |
| 2324 | { | 2323 | { |
| 2325 | KScopedAutoObject writable_event = handle_table.GetObject<KWritableEvent>(event_handle); | 2324 | KScopedAutoObject event = handle_table.GetObject<KEvent>(event_handle); |
| 2326 | if (writable_event.IsNotNull()) { | 2325 | if (event.IsNotNull()) { |
| 2327 | return writable_event->Clear(); | 2326 | return event->Clear(); |
| 2328 | } | 2327 | } |
| 2329 | } | 2328 | } |
| 2330 | 2329 | ||
| @@ -2362,24 +2361,24 @@ static Result CreateEvent(Core::System& system, Handle* out_write, Handle* out_r | |||
| 2362 | R_UNLESS(event != nullptr, ResultOutOfResource); | 2361 | R_UNLESS(event != nullptr, ResultOutOfResource); |
| 2363 | 2362 | ||
| 2364 | // Initialize the event. | 2363 | // Initialize the event. |
| 2365 | event->Initialize("CreateEvent", kernel.CurrentProcess()); | 2364 | event->Initialize(kernel.CurrentProcess()); |
| 2366 | 2365 | ||
| 2367 | // Commit the thread reservation. | 2366 | // Commit the thread reservation. |
| 2368 | event_reservation.Commit(); | 2367 | event_reservation.Commit(); |
| 2369 | 2368 | ||
| 2370 | // Ensure that we clean up the event (and its only references are handle table) on function end. | 2369 | // Ensure that we clean up the event (and its only references are handle table) on function end. |
| 2371 | SCOPE_EXIT({ | 2370 | SCOPE_EXIT({ |
| 2372 | event->GetWritableEvent().Close(); | ||
| 2373 | event->GetReadableEvent().Close(); | 2371 | event->GetReadableEvent().Close(); |
| 2372 | event->Close(); | ||
| 2374 | }); | 2373 | }); |
| 2375 | 2374 | ||
| 2376 | // Register the event. | 2375 | // Register the event. |
| 2377 | KEvent::Register(kernel, event); | 2376 | KEvent::Register(kernel, event); |
| 2378 | 2377 | ||
| 2379 | // Add the writable event to the handle table. | 2378 | // Add the event to the handle table. |
| 2380 | R_TRY(handle_table.Add(out_write, std::addressof(event->GetWritableEvent()))); | 2379 | R_TRY(handle_table.Add(out_write, event)); |
| 2381 | 2380 | ||
| 2382 | // Add the writable event to the handle table. | 2381 | // Ensure that we maintaing a clean handle state on exit. |
| 2383 | auto handle_guard = SCOPE_GUARD({ handle_table.Remove(*out_write); }); | 2382 | auto handle_guard = SCOPE_GUARD({ handle_table.Remove(*out_write); }); |
| 2384 | 2383 | ||
| 2385 | // Add the readable event to the handle table. | 2384 | // Add the readable event to the handle table. |