Fix locking the wrong mutex in GCAdapter_Android.cpp ResetRumble()
I am not confident there are no race conditions between s_write_mutex, s_controller_write_payload_size, and s_controller_write_payload. But this code should be safer than before.
This commit is contained in:
parent
7616027684
commit
b5a7ae52b5
|
@ -406,7 +406,7 @@ void ResetRumble()
|
||||||
{
|
{
|
||||||
unsigned char rumble[5] = {0x11, 0, 0, 0, 0};
|
unsigned char rumble[5] = {0x11, 0, 0, 0, 0};
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lk(s_read_mutex);
|
std::lock_guard<std::mutex> lk(s_write_mutex);
|
||||||
memcpy(s_controller_write_payload, rumble, 5);
|
memcpy(s_controller_write_payload, rumble, 5);
|
||||||
s_controller_write_payload_size.store(5);
|
s_controller_write_payload_size.store(5);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue