kernel: Pthread rewrite touchups for Windows
Some checks failed
Build and Release / reuse (push) Has been cancelled
Build and Release / clang-format (push) Has been cancelled
Build and Release / get-info (push) Has been cancelled
Build and Release / windows-sdl (push) Has been cancelled
Build and Release / windows-qt (push) Has been cancelled
Build and Release / macos-sdl (push) Has been cancelled
Build and Release / macos-qt (push) Has been cancelled
Build and Release / linux-sdl (push) Has been cancelled
Build and Release / linux-qt (push) Has been cancelled
Build and Release / pre-release (push) Has been cancelled

This commit is contained in:
Daniel R 2024-10-25 16:36:38 +03:00
commit d1247612e6
No known key found for this signature in database
GPG key ID: B8ADC8F57BA18DBA

View file

@ -286,7 +286,8 @@ int PS4_SYSV_ABI posix_pthread_create_name_np(PthreadT* thread, const PthreadAtt
pthread_attr_init(&pattr); pthread_attr_init(&pattr);
// pthread_attr_setstack(&pattr, new_thread->attr.stackaddr_attr, // pthread_attr_setstack(&pattr, new_thread->attr.stackaddr_attr,
// new_thread->attr.stacksize_attr); // new_thread->attr.stacksize_attr);
int ret = pthread_create(pthr, &pattr, (PthreadEntryFunc)RunThread, new_thread); using WinPthreadEntry = void *(*)(void*);
int ret = pthread_create(pthr, &pattr, (WinPthreadEntry)RunThread, new_thread);
ASSERT_MSG(ret == 0, "Failed to create thread with error {}", ret); ASSERT_MSG(ret == 0, "Failed to create thread with error {}", ret);
if (ret) { if (ret) {
*thread = nullptr; *thread = nullptr;
@ -343,7 +344,7 @@ int PS4_SYSV_ABI posix_pthread_once(PthreadOnce* once_control, void (*init_routi
} }
} }
const auto once_cancel_handler = [](void* arg) { const auto once_cancel_handler = [](void* arg) PS4_SYSV_ABI {
PthreadOnce* once_control = (PthreadOnce*)arg; PthreadOnce* once_control = (PthreadOnce*)arg;
auto state = PthreadOnceState::InProgress; auto state = PthreadOnceState::InProgress;
if (once_control->state.compare_exchange_strong(state, PthreadOnceState::NeverDone, if (once_control->state.compare_exchange_strong(state, PthreadOnceState::NeverDone,