-
-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathmain.cpp
More file actions
48 lines (37 loc) · 1022 Bytes
/
main.cpp
File metadata and controls
48 lines (37 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <coreinit/thread.h>
#include <coreinit/time.h>
#include <whb/proc.h>
#include <whb/log.h>
#include <whb/log_console.h>
#include <thread>
__thread
__attribute((tls_model("global-dynamic")))
const char* thread_name = "";
int
thread1_entry(void)
{
thread_name = "Thread1";
WHBLogPrintf("Hello from %-20s (thread_name@0x%08X)\n", thread_name, &thread_name);
return 0;
}
int
main(int argc, char **argv)
{
WHBProcInit();
WHBLogConsoleInit();
thread_name = "Main Thread";
WHBLogPrintf("Hello from %-20s (thread_name@0x%08X)\n", thread_name, &thread_name);
std::thread th1 = std::thread(thread1_entry);
th1.join();
WHBLogPrintf("Hello from %-20s (thread_name@0x%08X)\n", thread_name, &thread_name);
WHBLogConsoleDraw();
while(WHBProcIsRunning()) {
OSSleepTicks(OSMillisecondsToTicks(1000));
}
WHBLogPrintf("Exiting... good bye.");
WHBLogConsoleDraw();
OSSleepTicks(OSMillisecondsToTicks(1000));
WHBLogConsoleFree();
WHBProcShutdown();
return 0;
}