summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_thread.h
diff options
context:
space:
mode:
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