diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-09-14 19:34:42 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-09-14 19:34:42 +0000 |
commit | dda141f0798b79cfa71e78934ed1b968fcc20f53 (patch) | |
tree | 327942389d763f66201e47d49ad3253e0c0fe1d1 /protocols/Tox/src/tox_thread.h | |
parent | 98a324d2fb4babc09e94a10fef819f3409477eb2 (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.h | 32 |
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 |