mirror of
https://github.com/wiiu-env/wut.git
synced 2024-12-13 15:51:52 +01:00
a9829a3226
Overwrites bits/gthr-default.h to implement gthreads.
46 lines
912 B
C++
46 lines
912 B
C++
#include <coreinit/thread.h>
|
|
#include <coreinit/time.h>
|
|
#include <coreinit/systeminfo.h>
|
|
|
|
#include <whb/proc.h>
|
|
#include <whb/log.h>
|
|
#include <whb/log_console.h>
|
|
|
|
#include <thread>
|
|
|
|
int
|
|
hello_thread()
|
|
{
|
|
OSCalendarTime tm;
|
|
|
|
WHBProcInit();
|
|
WHBLogConsoleInit();
|
|
WHBLogPrintf("Hello World from a std::thread!");
|
|
|
|
while(WHBProcIsRunning()) {
|
|
OSTicksToCalendarTime(OSGetTime(), &tm);
|
|
WHBLogPrintf("%02d/%02d/%04d %02d:%02d:%02d I'm still here.",
|
|
tm.tm_mday, tm.tm_mon, tm.tm_year,
|
|
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
|
|
|
WHBLogConsoleDraw();
|
|
OSSleepTicks(OSMilliseconds(1000));
|
|
}
|
|
|
|
WHBLogPrintf("Exiting... good bye.");
|
|
WHBLogConsoleDraw();
|
|
OSSleepTicks(OSMilliseconds(1000));
|
|
|
|
WHBLogConsoleFree();
|
|
WHBProcShutdown();
|
|
return 0;
|
|
}
|
|
|
|
int
|
|
main(int argc, char **argv)
|
|
{
|
|
std::thread t(hello_thread);
|
|
t.join();
|
|
return 0;
|
|
}
|