summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2021-12-06 11:47:13 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-12-10 21:10:13 +0000
commitf6a46ae822407d8a08af0ab40d0487cf76a63f98 (patch)
tree80545dd22635b2b62d3bd9ca37568df27c1159c8
parent9ef815af0a5f8a408b06ec7d1b5fab7e9a181efc (diff)
QBluetoothSocket Windows: remove unneeded mutex
The SocketWorker::onReadyRead() callback is invoked in the same thread where the SocketWorker object is created. That means that we do not need to protect the access to data using mutex. Change-Id: Ie828d38ea1c79df245bf6944b7c22b1edeaaec36 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 49f546e053368b6458bfaa123832129c5d5d8be2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/bluetooth/qbluetoothsocket_winrt.cpp6
1 files changed, 0 insertions, 6 deletions
diff --git a/src/bluetooth/qbluetoothsocket_winrt.cpp b/src/bluetooth/qbluetoothsocket_winrt.cpp
index 50161fcb..d07cf7ef 100644
--- a/src/bluetooth/qbluetoothsocket_winrt.cpp
+++ b/src/bluetooth/qbluetoothsocket_winrt.cpp
@@ -159,7 +159,6 @@ signals:
public slots:
Q_INVOKABLE void notifyAboutNewData()
{
- QMutexLocker locker(&m_mutex);
const QList<QByteArray> newData = std::move(m_pendingData);
m_pendingData.clear();
emit newDataReceived(newData);
@@ -245,11 +244,9 @@ public:
}
QByteArray newData(reinterpret_cast<const char*>(data), int(bufferLength));
- QMutexLocker readLocker(&m_mutex);
if (m_pendingData.isEmpty())
QMetaObject::invokeMethod(this, "notifyAboutNewData", Qt::QueuedConnection);
m_pendingData << newData;
- readLocker.unlock();
UINT32 readBufferLength;
ComPtr<IInputStream> stream;
@@ -303,9 +300,6 @@ private:
QList<QByteArray> m_pendingData;
bool m_shuttingDown = false;
- // Protects pendingData/pendingDatagrams which are accessed from native callbacks
- QMutex m_mutex;
-
ComPtr<IAsyncOperationWithProgress<IBuffer *, UINT32>> m_readOp;
};