Files
XCSDD/docs/api/threading/thread/getcurrentid.md
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling
- Improve link styling with underline decoration
- Hide leaf nodes from tree, only show directories
- Fix log file path for packaged app
2026-03-19 12:44:08 +08:00

31 lines
659 B
Markdown

# Thread::GetCurrentId
```cpp
static Id GetCurrentId()
```
获取当前执行线程的唯一标识符。这是一个静态方法,可以在任何线程上下文中调用。
**参数:**
**返回:** `Thread::Id` - 当前执行线程的唯一标识符
**复杂度:** O(1)
**示例:**
```cpp
Thread worker;
worker.Start([]() {
printf("Worker thread id: %llu\n", (unsigned long long)Thread::GetCurrentId());
}, "WorkerThread");
printf("Main thread id: %llu\n", (unsigned long long)Thread::GetCurrentId());
worker.Join();
```
## 相关文档
- [Thread 总览](thread.md) - 返回类总览
- [GetId](getid.md) - 获取 Thread 对象的 ID