mirror of
https://github.com/simple64/simple64.git
synced 2026-11-04 00:23:33 +01:00
update parallel rdp
This commit is contained in:
1 parent
981d2d459b
commit
cf08f49a21
82 files changed
+59984
-51057
No files matched your search
@@ -24,6 +24,10 @@
|
||||
|
||||
#ifdef __linux__
|
||||
#include <pthread.h>
|
||||
#else
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
namespace Util
|
||||
@@ -33,8 +37,21 @@ void set_current_thread_name(const char *name)
|
||||
#ifdef __linux__
|
||||
pthread_setname_np(pthread_self(), name);
|
||||
#else
|
||||
// TODO: Kinda messy.
|
||||
(void)name;
|
||||
using PFN_SetThreadDescription = HRESULT (WINAPI *)(HANDLE, PCWSTR);
|
||||
auto module = GetModuleHandleA("kernel32.dll");
|
||||
PFN_SetThreadDescription SetThreadDescription = module ? reinterpret_cast<PFN_SetThreadDescription>(
|
||||
(void *)GetProcAddress(module, "SetThreadDescription")) : nullptr;
|
||||
|
||||
if (SetThreadDescription)
|
||||
{
|
||||
std::wstring wname;
|
||||
while (*name != '\0')
|
||||
{
|
||||
wname.push_back(*name);
|
||||
name++;
|
||||
}
|
||||
SetThreadDescription(GetCurrentThread(), wname.c_str());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user