windows: Change the default on SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 06 Jun 2017 13:12:43 -0400
changeset 11069abf45a095845
parent 11068 117d4ce1390e
child 11070 61401688628e
windows: Change the default on SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING.

It's easier for Visual Studio users that want this information to turn it on
or live without it, than it is to explain why every debugger that isn't Visual
Studio crashes out here. Eventually SetThreadDescription() will be the thing
everyone uses anyhow.

Fixes Bugzilla #3645.
(and several others).
include/SDL_hints.h
src/thread/windows/SDL_systhread.c
     1.1 --- a/include/SDL_hints.h	Tue Jun 06 12:35:35 2017 -0400
     1.2 +++ b/include/SDL_hints.h	Tue Jun 06 13:12:43 2017 -0400
     1.3 @@ -726,13 +726,18 @@
     1.4  #define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT"
     1.5  
     1.6  /**
     1.7 - * \brief Tell SDL not to name threads on Windows.
     1.8 + * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception.
     1.9 + *        The 0x406D1388 Exception is a trick used to inform Visual Studio of a
    1.10 + *        thread's name, but it tends to cause problems with other debuggers,
    1.11 + *        and the .NET runtime. Note that SDL 2.0.6 and later will still use
    1.12 + *        the (safer) SetThreadDescription API, introduced in the Windows 10
    1.13 + *        Creators Update, if available.
    1.14   *
    1.15   * The variable can be set to the following values:
    1.16   *   "0"       - SDL will raise the 0x406D1388 Exception to name threads.
    1.17 - *               This is the default behavior of SDL <= 2.0.4. (default)
    1.18 - *   "1"       - SDL will not raise this exception, and threads will be unnamed.
    1.19 - *               For .NET languages this is required when running under a debugger.
    1.20 + *               This is the default behavior of SDL <= 2.0.4.
    1.21 + *   "1"       - SDL will not raise this exception, and threads will be unnamed. (default)
    1.22 + *               This is necessary with .NET languages or debuggers that aren't Visual Studio.
    1.23   */
    1.24  #define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING"
    1.25  
     2.1 --- a/src/thread/windows/SDL_systhread.c	Tue Jun 06 12:35:35 2017 -0400
     2.2 +++ b/src/thread/windows/SDL_systhread.c	Tue Jun 06 13:12:43 2017 -0400
     2.3 @@ -199,7 +199,7 @@
     2.4              THREADNAME_INFO inf;
     2.5  
     2.6              /* C# and friends will try to catch this Exception, let's avoid it. */
     2.7 -            if (SDL_GetHintBoolean(SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING, SDL_FALSE)) {
     2.8 +            if (SDL_GetHintBoolean(SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING, SDL_TRUE)) {
     2.9                  return;
    2.10              }
    2.11