From dda141f0798b79cfa71e78934ed1b968fcc20f53 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Mon, 14 Sep 2015 19:34:42 +0000 Subject: Tox: fixed tox thread management git-svn-id: http://svn.miranda-ng.org/main/trunk@15354 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/src/tox_network.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'protocols/Tox/src/tox_network.cpp') diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp index 956378d9c4..0071d9b3f8 100644 --- a/protocols/Tox/src/tox_network.cpp +++ b/protocols/Tox/src/tox_network.cpp @@ -141,21 +141,9 @@ void CToxProto::CheckConnection(int &retriesCount) } } -void DoTox(ToxThreadData &toxThread) -{ - { - mir_cslock lock(toxThread.toxLock); - tox_iterate(toxThread.tox); - if (toxThread.toxAv) - toxav_do(toxThread.toxAv); - } - uint32_t interval = tox_iteration_interval(toxThread.tox); - Sleep(interval); -} - void CToxProto::PollingThread(void*) { - ToxThreadData toxThread; + CToxThread toxThread; this->toxThread = &toxThread; logger->Log(__FUNCTION__": entering"); @@ -175,10 +163,10 @@ void CToxProto::PollingThread(void*) while (!toxThread.isTerminated) { CheckConnection(retriesCount); - DoTox(toxThread); + toxThread.Do(); } - UninitToxCore(&toxThread); + UninitToxCore(); toxThread.isConnected = false; logger->Log(__FUNCTION__": leaving"); -- cgit v1.2.3