summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_thread.h
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-09-14 19:34:42 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-09-14 19:34:42 +0000
commitdda141f0798b79cfa71e78934ed1b968fcc20f53 (patch)
tree327942389d763f66201e47d49ad3253e0c0fe1d1 /protocols/Tox/src/tox_thread.h
parent98a324d2fb4babc09e94a10fef819f3409477eb2 (diff)
Tox: fixed tox thread management
git-svn-id: http://svn.miranda-ng.org/main/trunk@15354 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_thread.h')
-rw-r--r--protocols/Tox/src/tox_thread.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/protocols/Tox/src/tox_thread.h b/protocols/Tox/src/tox_thread.h
new file mode 100644
index 0000000000..892322b11c
--- /dev/null
+++ b/protocols/Tox/src/tox_thread.h
@@ -0,0 +1,32 @@
+#ifndef _TOX_THREAD_H_
+#define _TOX_THREAD_H_
+
+class CToxThread
+{
+public:
+ Tox *tox;
+ ToxAv *toxAv;
+ bool isConnected;
+ bool isTerminated;
+
+ mir_cs toxLock;
+
+ CToxThread() : tox(NULL), toxAv(NULL),
+ isConnected(false), isTerminated(false) { }
+
+ void Do()
+ {
+ {
+ mir_cslock lock(toxLock);
+ tox_iterate(tox);
+ if (toxAv)
+ toxav_do(toxAv);
+ }
+ uint32_t interval = tox_iteration_interval(tox);
+ Sleep(interval);
+ }
+
+ void Stop() { isTerminated = true; }
+};
+
+#endif //_TOX_THREAD_H_ \ No newline at end of file