summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-08-24 16:33:53 +0200
committerGitHub <noreply@github.com>2023-08-24 16:33:53 +0200
commit7d89f2c1460b121bad14da5d1c7e13cc24e20527 (patch)
tree0a834f0d8440bde19acc12a38ff59ee885e52eef
parentMerge pull request #11367 from FearlessTobi/fix-filesize (diff)
parentsockets: avoid locking around socket session calls (diff)
downloadyuzu-7d89f2c1460b121bad14da5d1c7e13cc24e20527.tar
yuzu-7d89f2c1460b121bad14da5d1c7e13cc24e20527.tar.gz
yuzu-7d89f2c1460b121bad14da5d1c7e13cc24e20527.tar.bz2
yuzu-7d89f2c1460b121bad14da5d1c7e13cc24e20527.tar.lz
yuzu-7d89f2c1460b121bad14da5d1c7e13cc24e20527.tar.xz
yuzu-7d89f2c1460b121bad14da5d1c7e13cc24e20527.tar.zst
yuzu-7d89f2c1460b121bad14da5d1c7e13cc24e20527.zip
-rw-r--r--src/core/hle/service/service.h4
-rw-r--r--src/core/hle/service/sockets/bsd.cpp5
-rw-r--r--src/core/hle/service/sockets/bsd.h3
3 files changed, 10 insertions, 2 deletions
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 45b2c43b7..d539ed0f4 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -79,8 +79,8 @@ protected:
using HandlerFnP = void (Self::*)(HLERequestContext&);
/// Used to gain exclusive access to the service members, e.g. from CoreTiming thread.
- [[nodiscard]] std::scoped_lock<std::mutex> LockService() {
- return std::scoped_lock{lock_service};
+ [[nodiscard]] virtual std::unique_lock<std::mutex> LockService() {
+ return std::unique_lock{lock_service};
}
/// System context that the service operates under.
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp
index 11f8efbac..d8509c1dd 100644
--- a/src/core/hle/service/sockets/bsd.cpp
+++ b/src/core/hle/service/sockets/bsd.cpp
@@ -1029,6 +1029,11 @@ BSD::~BSD() {
}
}
+std::unique_lock<std::mutex> BSD::LockService() {
+ // Do not lock socket IClient instances.
+ return {};
+}
+
BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} {
// clang-format off
static const FunctionInfo functions[] = {
diff --git a/src/core/hle/service/sockets/bsd.h b/src/core/hle/service/sockets/bsd.h
index 430edb97c..161f22b9b 100644
--- a/src/core/hle/service/sockets/bsd.h
+++ b/src/core/hle/service/sockets/bsd.h
@@ -186,6 +186,9 @@ private:
// Callback identifier for the OnProxyPacketReceived event.
Network::RoomMember::CallbackHandle<Network::ProxyPacket> proxy_packet_received;
+
+protected:
+ virtual std::unique_lock<std::mutex> LockService() override;
};
class BSDCFG final : public ServiceFramework<BSDCFG> {