aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bunnei <bunneidev@gmail.com>2015-01-14 23:33:37 -0500
committerGravatar bunnei <bunneidev@gmail.com>2015-01-21 18:42:04 -0500
commit14cbbf4d9b8e07f9f2d679bcf66c2180463ae57c (patch)
treef4a942c3b72d8df5186ad8bfe0a99fdbe2644dd5
parent5e77e2e1de73ce7786f52f2a74c28182fa4aa845 (diff)
Event: Get rid of permanent_lock hack.
-rw-r--r--src/core/hle/kernel/event.cpp37
-rw-r--r--src/core/hle/kernel/event.h7
2 files changed, 8 insertions, 36 deletions
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp
index bf71e9ed..9dd3d0f5 100644
--- a/src/core/hle/kernel/event.cpp
+++ b/src/core/hle/kernel/event.cpp
@@ -26,7 +26,6 @@ public:
ResetType reset_type; ///< Current ResetType
bool locked; ///< Event signal wait
- bool permanent_locked; ///< Hack - to set event permanent state (for easy passthrough)
std::string name; ///< Name of event (optional)
ResultVal<bool> WaitSynchronization() override {
@@ -35,7 +34,7 @@ public:
AddWaitingThread(GetCurrentThread());
Kernel::WaitCurrentThread(WAITTYPE_EVENT, this);
}
- if (reset_type != RESETTYPE_STICKY && !permanent_locked) {
+ if (reset_type != RESETTYPE_STICKY) {
locked = true;
}
return MakeResult<bool>(wait);
@@ -43,20 +42,6 @@ public:
};
/**
- * Hackish function to set an events permanent lock state, used to pass through synch blocks
- * @param handle Handle to event to change
- * @param permanent_locked Boolean permanent locked value to set event
- * @return Result of operation, 0 on success, otherwise error code
- */
-ResultCode SetPermanentLock(Handle handle, const bool permanent_locked) {
- Event* evt = g_handle_table.Get<Event>(handle).get();
- if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel);
-
- evt->permanent_locked = permanent_locked;
- return RESULT_SUCCESS;
-}
-
-/**
* Changes whether an event is locked or not
* @param handle Handle to event to change
* @param locked Boolean locked value to set event
@@ -66,9 +51,8 @@ ResultCode SetEventLocked(const Handle handle, const bool locked) {
Event* evt = g_handle_table.Get<Event>(handle).get();
if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel);
- if (!evt->permanent_locked) {
- evt->locked = locked;
- }
+ evt->locked = locked;
+
return RESULT_SUCCESS;
}
@@ -81,16 +65,13 @@ ResultCode SignalEvent(const Handle handle) {
Event* evt = g_handle_table.Get<Event>(handle).get();
if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel);
- // Resume threads waiting for event to signal
- bool event_caught = evt->ResumeAllWaitingThreads();
-
// If any thread is signalled awake by this event, assume the event was "caught" and reset
// the event. This will result in the next thread waiting on the event to block. Otherwise,
// the event will not be reset, and the next thread to call WaitSynchronization on it will
// not block. Not sure if this is correct behavior, but it seems to work.
- if (!evt->permanent_locked) {
- evt->locked = event_caught;
- }
+ // TODO(bunnei): Test how this works on hardware
+ evt->locked = evt->ResumeAllWaitingThreads();
+
return RESULT_SUCCESS;
}
@@ -103,9 +84,8 @@ ResultCode ClearEvent(Handle handle) {
Event* evt = g_handle_table.Get<Event>(handle).get();
if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel);
- if (!evt->permanent_locked) {
- evt->locked = true;
- }
+ evt->locked = true;
+
return RESULT_SUCCESS;
}
@@ -123,7 +103,6 @@ Event* CreateEvent(Handle& handle, const ResetType reset_type, const std::string
handle = Kernel::g_handle_table.Create(evt).ValueOr(INVALID_HANDLE);
evt->locked = true;
- evt->permanent_locked = false;
evt->reset_type = evt->intitial_reset_type = reset_type;
evt->name = name;
diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h
index da793df1..b1b9d4b7 100644
--- a/src/core/hle/kernel/event.h
+++ b/src/core/hle/kernel/event.h
@@ -19,13 +19,6 @@ namespace Kernel {
ResultCode SetEventLocked(const Handle handle, const bool locked);
/**
- * Hackish function to set an events permanent lock state, used to pass through synch blocks
- * @param handle Handle to event to change
- * @param permanent_locked Boolean permanent locked value to set event
- */
-ResultCode SetPermanentLock(Handle handle, const bool permanent_locked);
-
-/**
* Signals an event
* @param handle Handle to event to signal
*/