mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 06:26:49 +00:00
Add information about unnamed/main threads in logs and fatal dialog
* If thread is unnamed, keep log name empty for main thread, otherwise print thread id. In fatal dialog, main thread can be handled differently (with special remark that it's main thread). * Always print thread id in fatal dialog, regardless of thread type. Co-authored-by: Nekotekina <nekotekina@gmail.com>
This commit is contained in:
parent
40f3adc45f
commit
cd6ef2958b
6 changed files with 55 additions and 34 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include "Utilities/File.h"
|
||||
#include "Utilities/mutex.h"
|
||||
#include "Utilities/Thread.h"
|
||||
#include "Utilities/StrFmt.h"
|
||||
#include <cstring>
|
||||
#include <cstdarg>
|
||||
#include <string>
|
||||
|
|
@ -25,13 +26,18 @@ using namespace std::literals::chrono_literals;
|
|||
|
||||
#include <zlib.h>
|
||||
|
||||
static std::string empty_string()
|
||||
static std::string default_string()
|
||||
{
|
||||
return {};
|
||||
if (thread_ctrl::is_main())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
return fmt::format("TID: %s", std::this_thread::get_id());
|
||||
}
|
||||
|
||||
// Thread-specific log prefix provider
|
||||
thread_local std::string(*g_tls_log_prefix)() = &empty_string;
|
||||
thread_local std::string(*g_tls_log_prefix)() = &default_string;
|
||||
|
||||
// Another thread-specific callback
|
||||
thread_local void(*g_tls_log_control)(const char* fmt, u64 progress) = [](const char*, u64){};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue