From ac3690f2057fb93ce18f156ff5ffd720a6d6f60c Mon Sep 17 00:00:00 2001 From: fearlessTobi Date: Sat, 24 Aug 2019 15:57:49 +0200 Subject: Input: UDP Client to provide motion and touch controls An implementation of the cemuhook motion/touch protocol, this adds the ability for users to connect several different devices to citra to send direct motion and touch data to citra. Co-Authored-By: jroweboy --- src/common/thread.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/common/thread.h') diff --git a/src/common/thread.h b/src/common/thread.h index 0cfd98be6..5584c3bf3 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -28,6 +28,15 @@ public: is_set = false; } + template + bool WaitFor(const std::chrono::duration& time) { + std::unique_lock lk(mutex); + if (!condvar.wait_for(lk, time, [this] { return is_set; })) + return false; + is_set = false; + return true; + } + template bool WaitUntil(const std::chrono::time_point& time) { std::unique_lock lk{mutex}; -- cgit v1.2.3 From bbd85a495a3576a5ec99cd69b54e983653b38ea4 Mon Sep 17 00:00:00 2001 From: FearlessTobi Date: Sun, 3 Nov 2019 08:07:04 +0100 Subject: Address second part of review comments --- src/common/thread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common/thread.h') diff --git a/src/common/thread.h b/src/common/thread.h index 5584c3bf3..2fc071685 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -30,7 +30,7 @@ public: template bool WaitFor(const std::chrono::duration& time) { - std::unique_lock lk(mutex); + std::unique_lock lk{mutex}; if (!condvar.wait_for(lk, time, [this] { return is_set; })) return false; is_set = false; -- cgit v1.2.3