From 03d28dde1635e36508cff1f9eabc265cdb5febb9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 16 Jan 2019 05:58:48 +0100 Subject: compat/mutex: remove Always use the adaptive QMutex. --- proto-udp/ftnoir_protocol_ftn.cpp | 7 ++++--- proto-udp/ftnoir_protocol_ftn.h | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'proto-udp') diff --git a/proto-udp/ftnoir_protocol_ftn.cpp b/proto-udp/ftnoir_protocol_ftn.cpp index def3ebb1..000a0a79 100644 --- a/proto-udp/ftnoir_protocol_ftn.cpp +++ b/proto-udp/ftnoir_protocol_ftn.cpp @@ -21,15 +21,16 @@ udp::udp() Qt::DirectConnection); } -void udp::pose(const double *headpose) { - spinlock_guard l(spl); +void udp::pose(const double *headpose) +{ + QMutexLocker l(&lock); outSocket.writeDatagram((const char *) headpose, sizeof(double[6]), dest_ip, dest_port); } void udp::set_dest_address() { - spinlock_guard l(spl); + QMutexLocker l(&lock); dest_port = (unsigned short)s.port; dest_ip = QHostAddress((s.ip1.to() & 0xff) << 24 | diff --git a/proto-udp/ftnoir_protocol_ftn.h b/proto-udp/ftnoir_protocol_ftn.h index a7c90f5b..53387a6c 100644 --- a/proto-udp/ftnoir_protocol_ftn.h +++ b/proto-udp/ftnoir_protocol_ftn.h @@ -12,7 +12,6 @@ #include "ui_ftnoir_ftncontrols.h" #include "api/plugin-api.hpp" -#include "compat/spinlock.hpp" #include "options/options.hpp" using namespace options; #include @@ -42,7 +41,7 @@ private: QUdpSocket outSocket; settings s; - mutable std::atomic_flag spl = ATOMIC_FLAG_INIT; + mutable QMutex lock; QHostAddress dest_ip { 127u << 24 | 1u }; unsigned short dest_port = 65535; -- cgit v1.2.3