JackTrip
ThreadPoolTest.h
Go to the documentation of this file.
1
7#ifndef __THREADPOOLTEST_H__
8#define __THREADPOOLTEST_H__
9
10#include <QThreadPool>
11#include <QEventLoop>
12#include <QThread>
13#include <QObject>
14
15#include <iostream>
16
17#include "NetKS.h"
19
20
21class ThreadPoolTest : public QObject, public QRunnable
22 //class ThreadPoolTest : public QThread
23{
24 Q_OBJECT;
25
26public:
28 {
29 setAutoDelete(false);
30 }
31
32 void run()
33 {
35 QThread testThread;
36 //jtm.moveToThread(&testThread);
37
38 //QObject::connect(&jtm, SIGNAL(signalTest()), &jtm, SLOT(slotTest()), Qt::QueuedConnection);
39 testThread.start();
40 jtm.play();
41 //testThread.wait();
42
43 //std::cout << "--------------- BEFORE ---------------" << std::endl;
44 //NetKS netks;
45 //netks.play();
46 //std::cout << "--------------- AFTER ---------------" << std::endl;
47
48 QEventLoop loop;
49 //QObject::connect(this, SIGNAL(stopELoop()), &loop, SLOT(quit()), Qt::QueuedConnection);
50 loop.exec();
51 //std::cout << "--------------- EXITING QRUNNABLE---------------" << std::endl;
52 /*
53 while (true) {
54 std::cout << "Hello world from thread" << std::endl;
55 sleep(1);
56 }
57 */
58 }
59
60 void stop()
61 {
62 std::cout << "--------------- ELOOP STOP---------------" << std::endl;
63 emit stopELoop();
64 }
65
66signals:
67 void stopELoop();
68
69private slots:
70 void fromServer()
71 {
72 std::cout << "--------------- SIGNAL RECEIVED ---------------" << std::endl;
73 }
74
75};
76
77#endif //__THREADPOOLTEST_H__
Definition: JackTripWorkerMessages.h:47
void play()
Definition: JackTripWorkerMessages.h:54
Definition: ThreadPoolTest.h:23
ThreadPoolTest()
Definition: ThreadPoolTest.h:27
void run()
Definition: ThreadPoolTest.h:32
void stop()
Definition: ThreadPoolTest.h:60