src/thread/windows/SDL_systhread.c


Log

Author Commit Date CI Message
Ozkan Sezer 265a1cc9 2021-01-05T15:50:02 use WIN_StringToUTF8W instead of WIN_StringToUTF8 where needed (#2) cf. bug #5435. - SDL_wasapi_win32.c (GetWasapiDeviceName): pwszVal is WCHAR* - windows/SDL_sysfilesystem.c (SDL_GetBasePath, SDL_GetPrefPath) - windows/SDL_sysurl.c (SDL_SYS_OpenURL): wurl is WCHAR* - SDL_windowssensor.c (ConnectSensor): bstr_name is WCHAR* - windows/SDL_systhread.c (SDL_SYS_SetupThread): strw is WCHAR*
Ozkan Sezer 01a2f276 2021-01-04T01:23:50 consistently use TEXT() macro with LoadLibrary() and GetModuleHandle() cf. bug #5435.
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Ozkan Sezer a19c008a 2020-12-22T17:10:02 use GetModuleHandleW() to retrieve kernel32.dll handle (bug #5390.) SDL_systhread.c and SDL_syslocale.c used to call LoadLibrary() without calling FreeLibrary() later. GetModuleHandleW() should always succeed because GetModuleHandleW() itself is imported from kernel32.dll and we don't need to bother releasing it.
Ryan C. Gordon 46bb47cf 2020-03-26T22:14:59 thread: Put all important SDL_CreateThread internal data into SDL_Thread. This avoids the need to malloc something extra, use a semaphore, etc, and fixes Emscripten with pthreads support, which might not spin up a web worker until after SDL_CreateThread returns and thus can't wait on a semaphore at this point in any case. Fixes Bugzilla #5064.
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sam Lantinga ac23d78f 2019-03-19T16:53:55 Didn't need to add SDL_windows.h include, that was already included
Sam Lantinga b2e76d86 2019-03-19T16:52:09 Fixed Windows RT build
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Sam Lantinga f521b22e 2018-04-23T22:07:56 Added SDL_THREAD_PRIORITY_TIME_CRITICAL
sezero 40b27fd5 2018-02-12T17:00:00 revert the recent typecast assignment changes (see bug #4079) also change the void* typedefs for the two vulkan function pointers added in vulkan_internal.h into generic function pointer typedefs.
Sam Lantinga 90e72bf4 2018-01-30T18:08:34 Fixed ISO C99 compatibility SDL now builds with gcc 7.2 with the following command line options: -Wall -pedantic-errors -Wno-deprecated-declarations -Wno-overlength-strings --std=c99
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Ryan C. Gordon 6d661cab 2017-06-06T13:12:43 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).
Ryan C. Gordon d1eb2d19 2017-02-13T17:05:14 thread: Don't use SetThreadDescription on WinRT right now. Can't LoadLibrary for it, but not sure if it's actually available there yet.
Ryan C. Gordon 8fa9b57f 2017-01-27T20:50:30 windows: first shot at naming threads with SetThreadDescription(). This is a bleeding edge API, added to Windows 10 Anniversary Edition (build 1607, specifically). https://msdn.microsoft.com/en-us/library/windows/desktop/mt774976(v=vs.85).aspx Nothing supports this yet, including WinDbg, Visual Studio, minidumps, etc, so we still need to also use the RaiseException hack. But presumably tools will use this API as a more robust and universal way to get thread names sooner or later, so we'll start broadcasting to it now.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Sam Lantinga 27d4f099 2016-10-07T23:40:44 Implemented SDL_GetHintBoolean() to make it easier to check boolean hints
Sam Lantinga 9f854cdb 2016-10-01T10:08:34 Fixed bug 3388 - Fail to build src/thread/windows/SDL_systhread.c on MinGW 4.9.3 Vitaly Novichkov Line 124 ==================================================================== const DWORD flags = thread->stacksize ? STACK_SIZE_PARAM_IS_A_RESERVATION : 0; ==================================================================== Error of compiler: ==================================================================== CC build/SDL_systhread.lo src/thread/windows/SDL_systhread.c: In function 'SDL_SYS_CreateThread': src/thread/windows/SDL_systhread.c:124:45: error: 'STACK_SIZE_PARAM_IS_A_RESERVA TION' undeclared (first use in this function) const DWORD flags = thread->stacksize ? STACK_SIZE_PARAM_IS_A_RESERVATION : 0; ^ src/thread/windows/SDL_systhread.c:124:45: note: each undeclared identifier is r eported only once for each function it appears in make: *** [build/SDL_systhread.lo] Error 1 ==================================================================== Fixing when I adding into begin of the file: ==================================================================== #ifndef STACK_SIZE_PARAM_IS_A_RESERVATION #define STACK_SIZE_PARAM_IS_A_RESERVATION 0x00010000 #endif ====================================================================
Ethan Lee 92d700f1 2016-09-30T09:26:57 SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING
Ryan C. Gordon 9b9ca093 2016-04-12T18:12:04 windows: created threads' stack sizes should be reserved, not committed.
Ryan C. Gordon 7ae2951f 2016-04-12T14:38:50 threads: Handle SDL_HINT_THREAD_STACK_SIZE at top level, implement elsewhere.
Ryan C. Gordon 481a21b0 2016-02-21T17:21:29 Windows: Just use WaitForSingleObjectEx() everywhere. (It's supported on WinXP, no reason to have an #ifdef here...I think.)
Ryan C. Gordon 9fd4d4dd 2016-02-21T17:05:25 Windows: let threads be named in the debugger. We now only raise the magic exception that names the thread when IsDebuggerPresent() returns true. In such a case, Visual Studio will catch the exception, set the thread name, and let the debugged process continue normally. If the debugger isn't running, we don't raise an exception at all. Setting the name is a debugger trick; if the debugger isn't running, the name won't be set if attached later in any case, so this doesn't lose functionality. This lets this code work without assembly code, on win32 and win64, and across various compilers. The only "gotcha" is that if you have something attached that looks like a debugger but doesn't respect this magic exception trick, the process will likely crash, but that's probably a deficiency of the attached program. Fixes Bugzilla #2089.
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
David Ludwig fa2d5ab4 2015-11-26T13:51:03 WinRT: bug-fix - SDL_SetThreadPriority() didn't work on WinRT 8.x platforms WinRT 8.0 (Phone and non-Phone) didn't offer an API to set an already-created thread's priority. WinRT 8.1 offered this API, along with several other Win32 thread functions that were previously unavailable (in WinRT). This change makes WinRT 8.1+ platforms use SDL's Win32 backend.
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
Ryan C. Gordon 7e1289af 2013-11-24T23:56:17 Make internal SDL sources include SDL_internal.h instead of SDL_config.h The new header will include SDL_config.h, but allows for other global stuff.
Ryan C. Gordon 8d6e03f3 2013-11-14T00:52:39 Added SDL_DetachThread() API.
Ryan C. Gordon dddb8787 2013-10-20T23:08:45 Disable Win32 thread naming again. See Bugzilla #2089.
Sam Lantinga 12ca3ce3 2013-10-17T23:02:29 Fixed building using MinGW Our SDL_windows.h needed to be included before anything else so UNICODE is defined.
Ryan C. Gordon 83383c65 2013-09-07T13:47:14 Disable thread naming on Win64 for now. We can't use _try/_except without the C runtime, and we can't use inline asm with the Win64 compiler. We'll need to move this to an .asm file or something later.
Ryan C. Gordon 2bafbeda 2013-08-31T01:36:38 Enabled thread naming on Windows. This is now done without compiler or C runtime support for __try/__except. (Granted, it uses Visual Studio-style inline asm, but still...)
Gabriel Jacobo dad42067 2013-08-12T11:13:50 Fixes #2022, do not resume on Android when surfaceChanged If the app is in landscape mode and the user presses the power button, a pause is followed immediately by a surfaceChanged event because the lock screen is shown in portrait mode. This triggers a "false" resume. So, we just pause and resume following the onWindowFocusChanged events. Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before blocking the event pump.
Sam Lantinga 1ad936eb 2013-08-11T19:56:43 Fixed bug 2027 - Full-screen appears to be broken - hang in SDL_DestroyWindow() Rainer Deyke I'm running Linux Mint 15 with the Cinnamon window manager. SDL_DestroyWindow consistently locks up for me when the window if fullscreen.