Skip to content

Commit

Permalink
Fix setting thread names on ATV (#3194)
Browse files Browse the repository at this point in the history
b/339454606

Change-Id: I69ea6af11ba9ade344a1250e67bef4f6b5dbce54
  • Loading branch information
y4vor authored May 8, 2024
1 parent 02bd375 commit 58da1e5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion base/threading/platform_thread_starboard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "base/logging.h"
#include "base/threading/thread_id_name_manager.h"
#include "base/threading/thread_restrictions.h"
#include "starboard/configuration_constants.h"
#include "starboard/thread.h"

namespace base {
Expand Down Expand Up @@ -128,7 +129,9 @@ void PlatformThread::Sleep(TimeDelta duration) {
// static
void PlatformThread::SetName(const std::string& name) {
ThreadIdNameManager::GetInstance()->SetName(name);
pthread_setname_np(pthread_self(), name.c_str());

std::string buffer(name, 0, kSbMaxThreadNameLength - 1);
pthread_setname_np(pthread_self(), buffer.c_str());
}

// static
Expand Down

0 comments on commit 58da1e5

Please sign in to comment.