diff options
Diffstat (limited to 'test/03Thread/threadtest.cpp')
-rw-r--r-- | test/03Thread/threadtest.cpp | 19 |
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(); |