summaryrefslogtreecommitdiffhomepage
path: root/tracker-hatire/thread.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-05-04 07:22:13 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-05-04 07:22:13 +0200
commit7f1f658fec4a1f50d78dc8b8c4efe22bb6a9636b (patch)
tree74fb6dd72ef461e57d007676a72b34777e3e0309 /tracker-hatire/thread.cpp
parent38dd6e55d20adfd830d834c394fc6ce7373a4805 (diff)
tracker/hatire: remove race
Don't prepend existing remaining data racing with add new data. Expose the lock as a public member.
Diffstat (limited to 'tracker-hatire/thread.cpp')
-rwxr-xr-x[-rw-r--r--]tracker-hatire/thread.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/tracker-hatire/thread.cpp b/tracker-hatire/thread.cpp
index 26bdc14d..83b712c2 100644..100755
--- a/tracker-hatire/thread.cpp
+++ b/tracker-hatire/thread.cpp
@@ -275,16 +275,13 @@ void hatire_thread::on_serial_read()
portable::sleep(ms);
}
-void hatire_thread::prepend_unread_data(const QByteArray &data)
+void hatire_thread::prepend_unread_data_nolock(const QByteArray &data)
{
- QMutexLocker lck(&data_mtx);
data_read.prepend(data);
}
-QByteArray hatire_thread::flush_data_read()
+QByteArray hatire_thread::flush_data_read_nolock()
{
- QMutexLocker lck(&data_mtx);
-
constexpr int packet_len = 30;
if (data_read.length() < 4 * packet_len)