summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/semaphore.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-01-18 04:23:49 +0100
committerbunnei <bunneidev@gmail.com>2015-01-22 01:10:24 +0100
commitaa01c57ae9d73e41b65d37860ca6fbb91caba33a (patch)
tree904936860b1e8319ec5edc3a1e0e6c2c12f01d9f /src/core/hle/kernel/semaphore.cpp
parentWaitSynchronizationN: Handle case where handles=nullptr. (diff)
downloadyuzu-aa01c57ae9d73e41b65d37860ca6fbb91caba33a.tar
yuzu-aa01c57ae9d73e41b65d37860ca6fbb91caba33a.tar.gz
yuzu-aa01c57ae9d73e41b65d37860ca6fbb91caba33a.tar.bz2
yuzu-aa01c57ae9d73e41b65d37860ca6fbb91caba33a.tar.lz
yuzu-aa01c57ae9d73e41b65d37860ca6fbb91caba33a.tar.xz
yuzu-aa01c57ae9d73e41b65d37860ca6fbb91caba33a.tar.zst
yuzu-aa01c57ae9d73e41b65d37860ca6fbb91caba33a.zip
Diffstat (limited to 'src/core/hle/kernel/semaphore.cpp')
-rw-r--r--src/core/hle/kernel/semaphore.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/core/hle/kernel/semaphore.cpp b/src/core/hle/kernel/semaphore.cpp
index 288928441..6464b2580 100644
--- a/src/core/hle/kernel/semaphore.cpp
+++ b/src/core/hle/kernel/semaphore.cpp
@@ -32,18 +32,27 @@ public:
return available_count > 0;
}
- ResultVal<bool> WaitSynchronization(unsigned index) override {
+ ResultVal<bool> Wait(unsigned index) override {
bool wait = !IsAvailable();
if (wait) {
Kernel::WaitCurrentThread_WaitSynchronization(WAITTYPE_SEMA, this, index);
AddWaitingThread(GetCurrentThread());
- } else {
- --available_count;
}
return MakeResult<bool>(wait);
}
+
+ ResultVal<bool> Acquire() override {
+ bool res = false;
+
+ if (IsAvailable()) {
+ --available_count;
+ res = true;
+ }
+
+ return MakeResult<bool>(res);
+ }
};
////////////////////////////////////////////////////////////////////////////////////////////////////