- 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
31 lines
654 B
Markdown
31 lines
654 B
Markdown
# Thread::GetId
|
||
|
||
```cpp
|
||
Id GetId() const
|
||
```
|
||
|
||
获取当前线程对象的唯一标识符。该 ID 在线程启动后有效。
|
||
|
||
**参数:** 无
|
||
|
||
**返回:** `Thread::Id` - 线程的唯一标识符(uint64_t 类型)
|
||
|
||
**复杂度:** O(1)
|
||
|
||
**注意:** 在调用 Start 之前返回 0。
|
||
|
||
**示例:**
|
||
|
||
```cpp
|
||
Thread worker;
|
||
printf("Before start: id=%llu\n", (unsigned long long)worker.GetId());
|
||
worker.Start([]() {}, "Test");
|
||
printf("After start: id=%llu\n", (unsigned long long)worker.GetId());
|
||
worker.Join();
|
||
```
|
||
|
||
## 相关文档
|
||
|
||
- [Thread 总览](thread.md) - 返回类总览
|
||
- [GetCurrentId](getcurrentid.md) - 获取当前执行线程的 ID
|