mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-30 11:24:16 +01:00
Fix thread name setting
We utilize `pthread_setname_np` to set the thread names but didn't check for any errors which resulted in the `Skyline-Choreographer` and `ChannelCmdFifo` not having proper names as they exceeded the 16 character limit on thread names for the pthread function. This has now been fixed by changing the names and introducing error checking to invocations of this function.
This commit is contained in:
parent
7a0cfb484c
commit
6e09dc5204
@ -65,7 +65,9 @@ namespace skyline::gpu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PresentationEngine::ChoreographerThread() {
|
void PresentationEngine::ChoreographerThread() {
|
||||||
pthread_setname_np(pthread_self(), "Skyline-Choreographer");
|
if (int result{pthread_setname_np(pthread_self(), "Sky-Choreo")})
|
||||||
|
Logger::Warn("Failed to set the thread name: {}", strerror(result));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
signal::SetSignalHandler({SIGINT, SIGILL, SIGTRAP, SIGBUS, SIGFPE, SIGSEGV}, signal::ExceptionalSignalHandler);
|
signal::SetSignalHandler({SIGINT, SIGILL, SIGTRAP, SIGBUS, SIGFPE, SIGSEGV}, signal::ExceptionalSignalHandler);
|
||||||
choreographerLooper = ALooper_prepare(0);
|
choreographerLooper = ALooper_prepare(0);
|
||||||
|
@ -35,9 +35,12 @@ namespace skyline::kernel::type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void KThread::StartThread() {
|
void KThread::StartThread() {
|
||||||
std::array<char, 16> threadName;
|
std::array<char, 16> threadName{};
|
||||||
pthread_getname_np(pthread, threadName.data(), threadName.size());
|
if (int result{pthread_getname_np(pthread, threadName.data(), threadName.size())})
|
||||||
pthread_setname_np(pthread, fmt::format("HOS-{}", id).c_str());
|
Logger::Warn("Failed to get the thread name: {}", strerror(result));
|
||||||
|
|
||||||
|
if (int result{pthread_setname_np(pthread, fmt::format("HOS-{}", id).c_str())})
|
||||||
|
Logger::Warn("Failed to set the thread name: {}", strerror(result));
|
||||||
Logger::UpdateTag();
|
Logger::UpdateTag();
|
||||||
|
|
||||||
if (!ctx.tpidrroEl0)
|
if (!ctx.tpidrroEl0)
|
||||||
@ -60,7 +63,8 @@ namespace skyline::kernel::type {
|
|||||||
Signal();
|
Signal();
|
||||||
|
|
||||||
if (threadName[0] != 'H' || threadName[1] != 'O' || threadName[2] != 'S' || threadName[3] != '-') {
|
if (threadName[0] != 'H' || threadName[1] != 'O' || threadName[2] != 'S' || threadName[3] != '-') {
|
||||||
pthread_setname_np(pthread, threadName.data());
|
if (int result{pthread_setname_np(pthread, threadName.data())})
|
||||||
|
Logger::Warn("Failed to set the thread name: {}", strerror(result));
|
||||||
Logger::UpdateTag();
|
Logger::UpdateTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,7 +340,9 @@ namespace skyline::soc::gm20b {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ChannelGpfifo::Run() {
|
void ChannelGpfifo::Run() {
|
||||||
pthread_setname_np(pthread_self(), "GPFIFO");
|
if (int result{pthread_setname_np(pthread_self(), "GPFIFO")})
|
||||||
|
Logger::Warn("Failed to set the thread name: {}", strerror(result));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
signal::SetSignalHandler({SIGINT, SIGILL, SIGTRAP, SIGBUS, SIGFPE}, signal::ExceptionalSignalHandler);
|
signal::SetSignalHandler({SIGINT, SIGILL, SIGTRAP, SIGBUS, SIGFPE}, signal::ExceptionalSignalHandler);
|
||||||
signal::SetSignalHandler({SIGSEGV}, nce::NCE::HostSignalHandler); // We may access NCE trapped memory
|
signal::SetSignalHandler({SIGSEGV}, nce::NCE::HostSignalHandler); // We may access NCE trapped memory
|
||||||
|
@ -114,8 +114,8 @@ namespace skyline::soc::host1x {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ChannelCommandFifo::Run() {
|
void ChannelCommandFifo::Run() {
|
||||||
pthread_setname_np(pthread_self(), "ChannelCommandFifo");
|
if (int result{pthread_setname_np(pthread_self(), "ChannelCmdFifo")})
|
||||||
Logger::UpdateTag();
|
Logger::Warn("Failed to set the thread name: {}", strerror(result));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
signal::SetSignalHandler({SIGINT, SIGILL, SIGTRAP, SIGBUS, SIGFPE}, signal::ExceptionalSignalHandler);
|
signal::SetSignalHandler({SIGINT, SIGILL, SIGTRAP, SIGBUS, SIGFPE}, signal::ExceptionalSignalHandler);
|
||||||
|
Loading…
Reference in New Issue
Block a user