[Base] Fix formatting errors accidentally introduced
This commit is contained in:
parent
754e64fcf1
commit
96a7908c28
|
@ -7,11 +7,10 @@
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "xenia/base/threading.h"
|
|
||||||
|
|
||||||
#include "xenia/base/assert.h"
|
#include "xenia/base/assert.h"
|
||||||
#include "xenia/base/logging.h"
|
#include "xenia/base/logging.h"
|
||||||
#include "xenia/base/platform_win.h"
|
#include "xenia/base/platform_win.h"
|
||||||
|
#include "xenia/base/threading.h"
|
||||||
|
|
||||||
typedef HANDLE (*SetThreadDescriptionFn)(HANDLE hThread,
|
typedef HANDLE (*SetThreadDescriptionFn)(HANDLE hThread,
|
||||||
PCWSTR lpThreadDescription);
|
PCWSTR lpThreadDescription);
|
||||||
|
@ -44,15 +43,13 @@ struct THREADNAME_INFO {
|
||||||
|
|
||||||
void set_name(HANDLE thread, const std::string& name) {
|
void set_name(HANDLE thread, const std::string& name) {
|
||||||
auto kern = GetModuleHandleW(L"kernel32.dll");
|
auto kern = GetModuleHandleW(L"kernel32.dll");
|
||||||
if (kern)
|
if (kern) {
|
||||||
{
|
auto set_thread_description =
|
||||||
auto set_thread_description = (SetThreadDescriptionFn)GetProcAddress(kern, "SetThreadDescription");
|
(SetThreadDescriptionFn)GetProcAddress(kern, "SetThreadDescription");
|
||||||
if (set_thread_description)
|
if (set_thread_description) {
|
||||||
{
|
|
||||||
int len = MultiByteToWideChar(CP_ACP, 0, name.c_str(), -1, NULL, 0);
|
int len = MultiByteToWideChar(CP_ACP, 0, name.c_str(), -1, NULL, 0);
|
||||||
auto str = (LPWSTR)alloca(len * sizeof(WCHAR));
|
auto str = (LPWSTR)alloca(len * sizeof(WCHAR));
|
||||||
if (str)
|
if (str) {
|
||||||
{
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, name.c_str(), -1, str, len);
|
MultiByteToWideChar(CP_ACP, 0, name.c_str(), -1, str, len);
|
||||||
set_thread_description(thread, str);
|
set_thread_description(thread, str);
|
||||||
}
|
}
|
||||||
|
@ -75,9 +72,7 @@ void set_name(HANDLE thread, const std::string& name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_name(const std::string& name) {
|
void set_name(const std::string& name) { set_name(GetCurrentThread(), name); }
|
||||||
set_name(GetCurrentThread(), name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaybeYield() {
|
void MaybeYield() {
|
||||||
SwitchToThread();
|
SwitchToThread();
|
||||||
|
|
Loading…
Reference in New Issue