Interpret (PthreadT)-1 as current thread in posix_pthread_setaffinity_np

This commit is contained in:
Marcin Mikołajczyk 2025-05-17 14:38:48 +01:00
parent e2513d50be
commit e090a5f0d7

View File

@ -585,6 +585,9 @@ int PS4_SYSV_ABI posix_pthread_setaffinity_np(PthreadT thread, size_t cpusetsize
if (thread == nullptr || cpusetp == nullptr) { if (thread == nullptr || cpusetp == nullptr) {
return POSIX_EINVAL; return POSIX_EINVAL;
} }
if (thread == reinterpret_cast<PthreadT>(-1)) {
thread = posix_pthread_self();
}
auto* attr_ptr = &thread->attr; auto* attr_ptr = &thread->attr;
if (const auto ret = posix_pthread_attr_setaffinity_np(&attr_ptr, cpusetsize, cpusetp)) { if (const auto ret = posix_pthread_attr_setaffinity_np(&attr_ptr, cpusetsize, cpusetp)) {
return ret; return ret;