| 1 | @[has_globals] |
| 2 | module os |
| 3 | |
| 4 | fn C.GetCurrentThreadId() u32 |
| 5 | |
| 6 | // g_main_thread_id and is_main_thread can be used to determine if the current thread is the main thread. |
| 7 | // if need to get the tid of the main thread, can use the global variable g_main_thread_id |
| 8 | // instead of using thread_id() every time. |
| 9 | __global g_main_thread_id = u64(C.GetCurrentThreadId()) |
| 10 | |
| 11 | // is_main_thread returns whether the current thread is the main thread. |
| 12 | pub fn is_main_thread() bool { |
| 13 | return g_main_thread_id == u64(C.GetCurrentThreadId()) |
| 14 | } |
| 15 | |
| 16 | // The windows platform does not need to be handled. |
| 17 | fn signal_ignore_internal(_args ...Signal) { |
| 18 | } |
| 19 | |