mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-23 08:39:16 +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() {
|
void KThread::StartThread() {
|
||||||
|
pthread = pthread_self();
|
||||||
std::array<char, 16> threadName{};
|
std::array<char, 16> threadName{};
|
||||||
if (int result{pthread_getname_np(pthread, threadName.data(), threadName.size())})
|
if (int result{pthread_getname_np(pthread, threadName.data(), threadName.size())})
|
||||||
Logger::Warn("Failed to get the thread name: {}", strerror(result));
|
Logger::Warn("Failed to get the thread name: {}", strerror(result));
|
||||||
@ -216,12 +217,10 @@ namespace skyline::kernel::type {
|
|||||||
killed = false;
|
killed = false;
|
||||||
statusCondition.notify_all();
|
statusCondition.notify_all();
|
||||||
if (self) {
|
if (self) {
|
||||||
pthread = pthread_self();
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
StartThread();
|
StartThread();
|
||||||
} else {
|
} else {
|
||||||
thread = std::thread(&KThread::StartThread, this);
|
thread = std::thread(&KThread::StartThread, this);
|
||||||
pthread = thread.native_handle();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user