mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-23 08:19:17 +01:00
Setup KThread pthread handle in StartThread
Avoids a race with starting the thread and the handle not being set yet
This commit is contained in:
parent
9784ae23e9
commit
83c7ed314e
@ -35,6 +35,7 @@ namespace skyline::kernel::type {
|
||||
}
|
||||
|
||||
void KThread::StartThread() {
|
||||
pthread = pthread_self();
|
||||
std::array<char, 16> threadName{};
|
||||
if (int result{pthread_getname_np(pthread, threadName.data(), threadName.size())})
|
||||
Logger::Warn("Failed to get the thread name: {}", strerror(result));
|
||||
@ -216,12 +217,10 @@ namespace skyline::kernel::type {
|
||||
killed = false;
|
||||
statusCondition.notify_all();
|
||||
if (self) {
|
||||
pthread = pthread_self();
|
||||
lock.unlock();
|
||||
StartThread();
|
||||
} else {
|
||||
thread = std::thread(&KThread::StartThread, this);
|
||||
pthread = thread.native_handle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user