This is Unofficial EPICS BASE Doxygen Site
setThreadName.cpp File Reference
#include <windows.h>
+ Include dependency graph for setThreadName.cpp:

Go to the source code of this file.

Macros

#define VC_EXTRALEAN
 
#define STRICT
 

Functions

void setThreadName (DWORD dwThreadID, LPCSTR szThreadName)
 

Macro Definition Documentation

#define STRICT

Definition at line 13 of file setThreadName.cpp.

#define VC_EXTRALEAN

Definition at line 12 of file setThreadName.cpp.

Function Documentation

void setThreadName ( DWORD  dwThreadID,
LPCSTR  szThreadName 
)

Definition at line 26 of file setThreadName.cpp.

27 {
28 #if _MSC_VER >= 1300 && defined ( _DEBUG )
29  typedef struct tagTHREADNAME_INFO
30  {
31  DWORD dwType; // must be 0x1000
32  LPCSTR szName; // pointer to name (in user addr space)
33  DWORD dwThreadID; // thread ID (-1=caller thread)
34  DWORD dwFlags; // reserved for future use, must be zero
35  } THREADNAME_INFO;
36  THREADNAME_INFO info;
37  info.dwType = 0x1000;
38  info.szName = szThreadName;
39  info.dwThreadID = dwThreadID;
40  info.dwFlags = 0;
41 
42  __try
43  {
44  RaiseException( 0x406D1388, 0,
45  sizeof(info)/sizeof(DWORD), (const ULONG_PTR*)&info );
46  }
47  __except(EXCEPTION_CONTINUE_EXECUTION)
48  {
49  }
50 #endif
51 }