1/* 2Source: 3http://msdn.microsoft.com/en-us/cc300389.aspx#P 4 5License: 6This license governs use of code marked as “sample” or “example” available on 7this web site without a license agreement, as provided under the section above 8titled “NOTICE SPECIFIC TO SOFTWARE AVAILABLE ON THIS WEB SITE.” If you use 9such code (the “software”), you accept this license. If you do not accept the 10license, do not use the software. 11 121. Definitions 13 14The terms “reproduce,” “reproduction,” “derivative works,” and “distribution” 15have the same meaning here as under U.S. copyright law. 16 17A “contribution” is the original software, or any additions or changes to the 18software. 19 20A “contributor” is any person that distributes its contribution under this 21license. 22 23“Licensed patents” are a contributor’s patent claims that read directly on its 24contribution. 25 262. Grant of Rights 27 28(A) Copyright Grant - Subject to the terms of this license, including the 29license conditions and limitations in section 3, each contributor grants you a 30non-exclusive, worldwide, royalty-free copyright license to reproduce its 31contribution, prepare derivative works of its contribution, and distribute its 32contribution or any derivative works that you create. 33 34(B) Patent Grant - Subject to the terms of this license, including the license 35conditions and limitations in section 3, each contributor grants you a 36non-exclusive, worldwide, royalty-free license under its licensed patents to 37make, have made, use, sell, offer for sale, import, and/or otherwise dispose 38of its contribution in the software or derivative works of the contribution in 39the software. 40 413. Conditions and Limitations 42 43(A) No Trademark License- This license does not grant you rights to use any 44contributors’ name, logo, or trademarks. 45 46(B) If you bring a patent claim against any contributor over patents that you 47claim are infringed by the software, your patent license from such contributor 48to the software ends automatically. 49 50(C) If you distribute any portion of the software, you must retain all 51copyright, patent, trademark, and attribution notices that are present in the 52software. 53 54(D) If you distribute any portion of the software in source code form, you may 55do so only under this license by including a complete copy of this license 56with your distribution. If you distribute any portion of the software in 57compiled or object code form, you may only do so under a license that complies 58with this license. 59 60(E) The software is licensed “as-is.” You bear the risk of using it. The 61contributors give no express warranties, guarantees or conditions. You may 62have additional consumer rights under your local laws which this license 63cannot change. To the extent permitted under your local laws, the contributors 64exclude the implied warranties of merchantability, fitness for a particular 65purpose and non-infringement. 66 67(F) Platform Limitation - The licenses granted in sections 2(A) and 2(B) 68extend only to the software or derivative works that you create that run on a 69Microsoft Windows operating system product. 70*/ 71 72/* 73 * The original code can be found here: 74 * http://msdn.microsoft.com/en-us/library/xcb2z8hs(VS.71).aspx 75 */ 76 77#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_THREAD_WINDOWS_SET_NAME_H_ 78#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_THREAD_WINDOWS_SET_NAME_H_ 79 80namespace webrtc { 81 82struct THREADNAME_INFO 83{ 84 DWORD dwType; // must be 0x1000 85 LPCSTR szName; // pointer to name (in user addr space) 86 DWORD dwThreadID; // thread ID (-1 = caller thread) 87 DWORD dwFlags; // reserved for future use, must be zero 88}; 89 90void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) 91{ 92 THREADNAME_INFO info; 93 info.dwType = 0x1000; 94 info.szName = szThreadName; 95 info.dwThreadID = dwThreadID; 96 info.dwFlags = 0; 97 98 __try 99 { 100 RaiseException(0x406D1388, 0, sizeof(info) / sizeof(DWORD), 101 (ULONG_PTR*)&info); 102 } 103 __except (EXCEPTION_CONTINUE_EXECUTION) 104 { 105 } 106} 107} // namespace webrtc 108#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_THREAD_WINDOWS_SET_NAME_H_ 109