hotspot/src/os/windows/vm/os_windows.cpp
changeset 27164 6523fa019ffa
parent 26685 aa239a0dfbea
child 27400 c5955f4b7c84
equal deleted inserted replaced
27163:66521b7ba8d6 27164:6523fa019ffa
   743     return proc_count;
   743     return proc_count;
   744   }
   744   }
   745 }
   745 }
   746 
   746 
   747 void os::set_native_thread_name(const char *name) {
   747 void os::set_native_thread_name(const char *name) {
   748   // Not yet implemented.
   748 
   749   return;
   749   // See: http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx
       
   750   //
       
   751   // Note that unfortunately this only works if the process
       
   752   // is already attached to a debugger; debugger must observe
       
   753   // the exception below to show the correct name.
       
   754 
       
   755   const DWORD MS_VC_EXCEPTION = 0x406D1388;
       
   756   struct {
       
   757     DWORD dwType;     // must be 0x1000
       
   758     LPCSTR szName;    // pointer to name (in user addr space)
       
   759     DWORD dwThreadID; // thread ID (-1=caller thread)
       
   760     DWORD dwFlags;    // reserved for future use, must be zero
       
   761   } info;
       
   762 
       
   763   info.dwType = 0x1000;
       
   764   info.szName = name;
       
   765   info.dwThreadID = -1;
       
   766   info.dwFlags = 0;
       
   767 
       
   768   __try {
       
   769     RaiseException (MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(DWORD), (const ULONG_PTR*)&info );
       
   770   } __except(EXCEPTION_CONTINUE_EXECUTION) {}
   750 }
   771 }
   751 
   772 
   752 bool os::distribute_processes(uint length, uint* distribution) {
   773 bool os::distribute_processes(uint length, uint* distribution) {
   753   // Not yet implemented.
   774   // Not yet implemented.
   754   return false;
   775   return false;