#include "base/threading/platform_thread.h"
#include <errno.h>
#include <pthread.h>
#include <sched.h>
#include <stddef.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <atomic>
#include <cstdint>
#include <optional>
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/feature_list.h"
#include "base/files/file_util.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/metrics/field_trial_params.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/process/internal_linux.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/threading/platform_thread_internal_posix.h"
#include "base/threading/thread_id_name_manager.h"
#include "base/threading/thread_type_delegate.h"
#include "build/build_config.h"
namespace base {
namespace {
ThreadTypeDelegate* g_thread_type_delegate = …;
const FilePath::CharType kCgroupDirectory[] = …);
FilePath ThreadTypeToCgroupDirectory(const FilePath& cgroup_filepath,
ThreadType thread_type) { … }
void SetThreadCgroup(PlatformThreadId thread_id,
const FilePath& cgroup_directory) { … }
void SetThreadCgroupForThreadType(PlatformThreadId thread_id,
const FilePath& cgroup_filepath,
ThreadType thread_type) { … }
}
namespace internal {
const ThreadPriorityToNiceValuePairForTest
kThreadPriorityToNiceValueMapForTest[7] = …;
const ThreadTypeToNiceValuePair kThreadTypeToNiceValueMap[7] = …;
bool CanSetThreadTypeToRealtimeAudio() { … }
bool SetCurrentThreadTypeForPlatform(ThreadType thread_type,
MessagePumpType pump_type_hint) { … }
std::optional<ThreadPriorityForTest>
GetCurrentThreadPriorityForPlatformForTest() { … }
}
bool PlatformThreadLinux::IsThreadBackgroundedForTest(
PlatformThreadId thread_id) { … }
void PlatformThreadBase::SetName(const std::string& name) { … }
void PlatformThreadLinux::SetThreadTypeDelegate(ThreadTypeDelegate* delegate) { … }
void PlatformThreadLinux::SetThreadCgroupsForThreadType(
PlatformThreadId thread_id,
ThreadType thread_type) { … }
void PlatformThreadLinux::SetThreadType(ProcessId process_id,
PlatformThreadId thread_id,
ThreadType thread_type,
IsViaIPC via_ipc) { … }
namespace internal {
void SetThreadTypeLinux(ProcessId process_id,
PlatformThreadId thread_id,
ThreadType thread_type,
IsViaIPC via_ipc) { … }
}
}