aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-08-07 00:07:05 +0800
committerchai <chaifix@163.com>2018-08-07 00:07:05 +0800
commit4544dc42bb3f9bd548fc3180152ce4e88b42e7dd (patch)
tree34bf1a6a9d1fccb53d0d62751c2325c2223fdcd6 /test
parent27c16761d1a340e36a30edf1a6e0602644982d7f (diff)
*update
Diffstat (limited to 'test')
-rw-r--r--test/03Thread/threadtest.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/test/03Thread/threadtest.cpp b/test/03Thread/threadtest.cpp
index 08eb69d..a792e53 100644
--- a/test/03Thread/threadtest.cpp
+++ b/test/03Thread/threadtest.cpp
@@ -29,7 +29,7 @@ void onDraw()
}
-int thread2Runner(Thread* t)
+void thread2Runner(Thread* t)
{
int i = 0;
while (true)
@@ -37,22 +37,15 @@ int thread2Runner(Thread* t)
if (i++ == 1000000000)
{
i = 0;
- cout << (char*)(t->demand("test").pointer);
+ cout << (char*)(t->demand(1).pointer);
}
}
- return 0;
}
-Thread t("Thread 2", thread2Runner);
-
void sendFunc(void* p)
{
- t.send("test", (void*)"hello_");
-}
-
-int thread3Runner(void* p)
-{
- return 1;
+ Thread* t = (Thread*)p;
+ t->send(1, "hello_");
}
int main(int argc, char* argv[])
@@ -76,8 +69,10 @@ int main(int argc, char* argv[])
wndSetting.resizable = false;
wnd->init(&wndSetting);
+ Thread t("Count", thread2Runner);
+
t.start();
- timers.after(2000, sendFunc, nullptr);
+ timers.after(2000, sendFunc, &t);
game->run();