docs: fix naming conventions across threading, math, memory, core, and debug modules
threading/: - Rename 19 camelCase method files to hyphenated names - task-system: createtaskgroup→create-task-group, etc. - tasksystemconfig: enabletaskprofiling→enable-task-profiling, etc. - thread: getcurrentid→get-current-id, etc. - task: addref→add-ref, getid→get-id, etc. math/: - Rename underscore operator files to hyphenated - vector3: operator_add→operator-add, etc. - matrix4: gettranslation→get-translation, etc. - vector4: tovector3→to-vector3, constructor_vector3→constructor-vector3 - sphere: sphere_constructor→sphere-constructor, etc. memory/: - Remove duplicate memorymanager/ folder (kept manager/ which was correct) core/: - filewriter: Consolidate ctor-default.md and ctor-file.md into constructor.md - Rename dtor.md→destructor.md debug/: - filelogsink: Rename construct.md→constructor.md, ~filelogsink.md→destructor.md All overview pages updated with new file references.
This commit is contained in:
49
docs/api/threading/thread/get-name.md
Normal file
49
docs/api/threading/thread/get-name.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# Thread::GetName
|
||||
|
||||
```cpp
|
||||
const Containers::String& GetName() const;
|
||||
```
|
||||
|
||||
返回线程的名称。线程名称在调用 `Start()` 时通过参数指定,默认为 "Thread"。返回的引用指向内部存储的 `Containers::String` 对象。
|
||||
|
||||
线程名称主要用于调试、日志记录和性能分析工具中标识线程。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 线程名称的常量引用
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include "XCEngine/Threading/Thread.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace XCEngine::Threading;
|
||||
|
||||
int main() {
|
||||
Thread t1;
|
||||
t1.Start([]() {}, "RenderingThread");
|
||||
|
||||
Thread t2;
|
||||
t2.Start([]() {}, "PhysicsThread");
|
||||
|
||||
Thread t3;
|
||||
t3.Start([]() {});
|
||||
|
||||
std::cout << "Thread 1 name: " << t1.GetName().CStr() << std::endl;
|
||||
std::cout << "Thread 2 name: " << t2.GetName().CStr() << std::endl;
|
||||
std::cout << "Thread 3 name: " << t3.GetName().CStr() << std::endl;
|
||||
|
||||
t1.Join();
|
||||
t2.Join();
|
||||
t3.Join();
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Thread 总览](thread.md) - 返回类总览
|
||||
Reference in New Issue
Block a user