Skip to content

Commit

Permalink
Set thread name with pthread API
Browse files Browse the repository at this point in the history
Fixes #94
  • Loading branch information
shuhaowu committed Aug 3, 2024
1 parent 9dbda99 commit 79a28df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"recommendations": [
"ms-vscode.cpptools",
"llvm-vs-code-extensions.vscode-clangd"
"llvm-vs-code-extensions.vscode-clangd",
"cschlosser.doxdocgen"
]
}
2 changes: 2 additions & 0 deletions src/cactus_rt/thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ void* Thread::RunThread(void* data) {
auto* thread = static_cast<Thread*>(data);
thread->config_.scheduler->SetSchedAttr();

pthread_setname_np(pthread_self(), thread->name_.c_str());

thread->tracer_ = std::make_shared<tracing::ThreadTracer>(thread->name_, thread->config_.tracer_config.queue_size);
thread->tracer_->SetTid();

Expand Down

0 comments on commit 79a28df

Please sign in to comment.