Changeset View
Changeset View
Standalone View
Standalone View
plugins/debuggercommon/tests/debuggees/debugeethreads.cpp
Show All 11 Lines | 1 | /* | |||
---|---|---|---|---|---|
12 | 12 | | |||
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License | ||
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to | ||
15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
16 | Boston, MA 02110-1301, USA. | 16 | Boston, MA 02110-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | #include <iostream> | 18 | #include <iostream> | ||
19 | #include <QThread> | 19 | #include <QThread> | ||
20 | #ifndef _MSC_VER | ||||
20 | #include <unistd.h> | 21 | #include <unistd.h> | ||
22 | #endif | ||||
21 | 23 | | |||
22 | class TestThread : public QThread | 24 | class TestThread : public QThread | ||
23 | { | 25 | { | ||
24 | public: | 26 | public: | ||
25 | void run() override { | 27 | void run() override { | ||
26 | sleep(1); | 28 | sleep(1); | ||
kfunk: Not sure if the tests depend on that `sleep(...)` call, but if they don't you could just use… | |||||
27 | std::cout << "Hello, world!" << std::endl; | 29 | std::cout << "Hello, world!" << std::endl; | ||
28 | } | 30 | } | ||
29 | }; | 31 | }; | ||
30 | 32 | | |||
31 | 33 | | |||
32 | int main(int /*argc*/, char **/*argv*/) { | 34 | int main(int /*argc*/, char **/*argv*/) { | ||
33 | TestThread t1; | 35 | TestThread t1; | ||
34 | TestThread t2; | 36 | TestThread t2; | ||
35 | TestThread t3; | 37 | TestThread t3; | ||
36 | t1.start(); | 38 | t1.start(); | ||
37 | t2.start(); | 39 | t2.start(); | ||
38 | t3.start(); | 40 | t3.start(); | ||
39 | usleep(500000); | 41 | QThread::usleep(500000); | ||
40 | usleep(600000); | 42 | QThread::usleep(600000); | ||
41 | return 0; | 43 | return 0; | ||
42 | } | 44 | } |
Not sure if the tests depend on that sleep(...) call, but if they don't you could just use QThread::usleep(...)