Skip to content

Commit

Permalink
[Utils/ThreadPool] Added names to the thread pool's threads
Browse files Browse the repository at this point in the history
- This allows them to be referenced with this name within the profiler, and queried accordingly
  • Loading branch information
Razakhel committed Mar 22, 2024
1 parent 6ff19dc commit 2587c86
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/RaZ/Utils/ThreadPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ ThreadPool::ThreadPool(unsigned int threadCount) {

m_threads.reserve(threadCount);

for (unsigned int i = 0; i < threadCount; ++i) {
m_threads.emplace_back([this] () {
for (unsigned int threadIndex = 0; threadIndex < threadCount; ++threadIndex) {
m_threads.emplace_back([this, threadIndex] () {
const std::string threadName = "Thread pool - #" + std::to_string(threadIndex + 1);
tracy::SetThreadName(threadName.c_str());

std::function<void()> action;

while (true) {
Expand Down

0 comments on commit 2587c86

Please sign in to comment.