MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / SetCurrentThreadName

Function SetCurrentThreadName

source/MRMesh/MRSystem.cpp:103–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103void SetCurrentThreadName( const char * name )
104{
105#ifdef _MSC_VER
106 const DWORD MS_VC_EXCEPTION = 0x406D1388;
107
108 #pragma pack(push,8)
109 typedef struct tagTHREADNAME_INFO
110 {
111 DWORD dwType; // Must be 0x1000.
112 LPCSTR szName; // Pointer to name (in user addr space).
113 DWORD dwThreadID; // Thread ID (-1=caller thread).
114 DWORD dwFlags; // Reserved for future use, must be zero.
115 } THREADNAME_INFO;
116 #pragma pack(pop)
117
118 THREADNAME_INFO info;
119 info.dwType = 0x1000;
120 info.szName = name;
121 info.dwThreadID = GetCurrentThreadId();
122 info.dwFlags = 0;
123
124 #pragma warning(push)
125 #pragma warning(disable: 6320 6322)
126 __try
127 {
128 RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info);
129 }
130 __except (EXCEPTION_EXECUTE_HANDLER)
131 {
132 }
133 #pragma warning(pop)
134#elif defined(__APPLE__) && defined(__MACH__)
135 pthread_setname_np(name);
136#elif defined(__EMSCRIPTEN__)
137 (void)name;
138#else
139 pthread_setname_np( pthread_self(), name);
140#endif
141}
142
143
144std::filesystem::path GetExeDirectory()

Callers 6

pythonLaunchFunction · 0.85
startMethod · 0.85
initListenerThread_Method · 0.85
AsyncRequestMethod · 0.85
orderWithManualFinishFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected