src/thread


Log

Author Commit Date CI Message
Ryan C. Gordon 140cc460 2017-12-31T03:35:41 windows: Use WaitForSingleObjectEx() always This is available since Windows XP, so it's safe to use always, not just in a WinRT ifdef.
Sam Lantinga 0d011ec6 2017-08-28T00:22:23 Renaming of guard header names to quiet -Wreserved-id-macro
Sam Lantinga de91b124 2017-08-14T06:28:21 Fixed bug 3745 - specify SDLCALL as the calling convention for API callbacks Patches contributed by Ozkan Sezer
Sam Lantinga 7229397c 2017-08-11T21:47:31 Fixed bug 3258 - SDL_TryLockMutex blocks for pthreads with FAKE_RECURSIVE_MUTEX Ian Abbott I just spotted what I think is a bug in "src/thread/pthread/SDL_sysmutex.c" in the SDL_TryLockMutex function when FAKE_RECURSIVE_MUTEX is defined (for an implementation of Pthreads with no recursive mutex support). It calls pthread_mutex_lock instead of pthread_mutex_trylock, so it will block until the mutex is available instead of returning SDL_MUTEX_TIMEDOUT if it cannot lock the mutex immediately.
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 619ab7a2 2017-05-01T18:39:05 haiku: Various fixes from haikuports. Based on patch here: https://github.com/haikuports/haikuports/blob/master/media-libs/libsdl2/patches/libsdl2-2.0.5.patchset
Philipp Wiesemann 1517ba72 2017-04-02T21:33:54 PSP: Fixed error messages.
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 36156335 2016-11-20T21:34:54 Renaming of guard header names to quiet -Wreserved-id-macro Patch contributed by Sylvain
Philipp Wiesemann 97aa5775 2016-11-16T22:08:51 Fixed empty parameter list in signatures of internal functions.
Sam Lantinga 57d01d7d 2016-11-13T22:57:41 Patch from Sylvain to fix clang warnings
Sam Lantinga 74e1dd4c 2016-11-11T13:14:00 Define _GNU_SOURCE when building SDL
Sam Lantinga 83cb2b63 2016-10-14T06:57:55 Fixed bug 2758 - Android issues with NDK r10c and API-21 Sylvain After a long time, I found out more clearly what was going wrong. The native libraries should be built with a "APP_PLATFORM" as low as possible. Ideally, APP_PLATFORM should be equals to the minSdkVersion of the AndroidManifest.xml So that the application never runs on a lower APP_PLATFORM than it has been built for. An additional good patch would be to write explicitly in "jni/Application.mk": APP_PLATFORM=android-10 (If no APP_PLATFORM is set, the "targetSdkVersion" of the AndroidManifest.xml is applied as an APP_PLATFORM to the native libraries. And currently, this is bad, because targetSdkVersion is 12, whereas minSdkLevel is 10. And in fact, there is a warning from ndk: "Android NDK: WARNING: APP_PLATFORM android-12 is larger than android:minSdkVersion 10 in ./AndroidManifest.xml".) to precise what happened in the initial reported test-case: Let say the "c" code contains a call to "srand()". with APP_PLATFORM=android-21, libSDL2.so contains a undef reference to "srand()". with APP_PLATFORM=android-10, libSDL2.so contains a undef reference to "srand48()". but srand() is missing on devices with APP_PLATFORM=android-10 (it was in fact replaced by srand48()). So, if you build for android-21 (where srand() is available), you will really have a call to "srand()" and it will fail on android-10. That was the issue. The path tried to fix this by in fact always calling srand48(). SDL patches that were applied are beneficial anyway, there are implicitly allowing they backward compatibility of using android-21 on a android-10 platform. It can be helpful in case you want to target a higher APP_PLATFORM than minSdkVersion to have potentially access to more functions. Eg you want to have access to GLES3 functions (or other) of "android-21". But, if dlopen() fails (on android-10), you do a fall-back to GLES2.
Sam Lantinga 741aaf4c 2016-10-12T22:34:54 Added a note on how to allow non-root applications to increase their thread priority on Linux
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
Philipp Wiesemann 72dc8784 2016-04-14T21:09:45 PSP: Fixed compile error.
Ryan C. Gordon 9b9ca093 2016-04-12T18:12:04 windows: created threads' stack sizes should be reserved, not committed.
Ryan C. Gordon c61675dc 2016-04-12T16:45:10 threads: Move SDL's own thread creation to a new internal API. This allows us to set an explicit stack size (overriding the system default and the global hint an app might have set), and remove all the macro salsa for dealing with _beginthreadex and such, as internal threads always set those to NULL anyhow. I've taken some guesses on reasonable (and tiny!) stack sizes for our internal threads, but some of these might turn out to be too small in practice and need an increase. Most of them are simple functions, though.
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
Ryan C. Gordon 696cd797 2015-12-29T02:32:47 NetBSD: fixed issues with cpuinfo and pthread_setname_np (thanks, Thomas!). Fixes Bugzilla #3176.
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.
David Ludwig a5a80cd0 2015-11-15T13:04:42 WinRT: fixed crash in SDL_CondWaitTimeout, when using Win10's MSVC runtime
Philipp Wiesemann 98986f39 2015-08-15T21:21:29 Removed not needed call to pthread_attr_getstacksize() for SDL_CreateThread().
Philipp Wiesemann 29199056 2015-07-15T21:11:24 PSP: Fixed error handling in SDL_SemWaitTimeout(). Signed integers were converted to unsigned before being checked if smaller 0. Found by Cppcheck.
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().
Philipp Wiesemann 1a348aac 2015-06-17T21:05:25 Android: Fixed two warnings.
Sam Lantinga 45989035 2015-06-17T00:07:45 Partial fix for bug 2758 - Android issues with NDK r10c and API-21 Sylvain When using API 21 and running on an old device (android < 5.0 ?) some function are missing. functions are (at least) : signal, sigemptyset, atof, stpcpy (strcat and strcpy), srand, rand. Very few modifications on SDL to get this working : on SDL ====== Undefine android configuration : HAVE_SIGNAL HAVE_SIGACTION HAVE_ATOF In "SDL_systrhead.c", comment out the few block of lines with "sigemptyset". Android.mk: remove the compilation of "test" directory because it contains a few rand/srand calls Also, there are more discussions about this in internet : https://groups.google.com/forum/#!topic/android-ndk/RjO9WmG9pfE http://stackoverflow.com/questions/25475055/android-ndk-load-library-cannot-locate-srand
Sam Lantinga 98f9b88c 2015-06-13T13:36:47 Fixed bug 3011 - pthread/SDL_syssem.c requires _GNU_SOURCE Ozkan Sezer pthread/SDL_syssem.c requires _GNU_SOURCE predefined (like SDL_sysmutex.c), otherwise sem_timedwait() prototype might not be available to it. Problem seen with glibc-2.3.4.
Ryan C. Gordon 059a0307 2015-05-26T21:30:41 Uh, yeah, it helps to press "Save" before committing...
Ryan C. Gordon baea64e6 2015-05-26T21:19:23 Stack hint should look for 0, not -1, and not care about environment variables.
Ryan C. Gordon a8fa7bd1 2015-05-26T21:13:27 Added a hint to specify new thread stack size (thanks, Gabriel!). Fixes Bugzilla #2019. (we'll do a better fix when we break the API in SDL 2.1.)
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 86f87bf7 2015-01-31T22:45:54 Added missing guards in implementation for PSP. Thanks to Martin Gerhardy for pointing this out.
Philipp Wiesemann d036ad84 2015-01-31T22:43:05 Added missing include statements in implementation for PSP. SDL_internal.h should be included to support dynamic API and fix warnings.
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!
Sam Lantinga 7ed41da0 2014-11-28T04:37:50 Fixed bug 2411 - Even if built with --enable-clock_gettime, SDL2 still calls gettimeofday() Ben Swick Makes SDL_syscond.c and SDL_syssem.c use clock_gettime(CLOCK_REALTIME) when HAVE_CLOCK_GETTIME is defined.
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
Sam Lantinga afe14829 2014-06-25T00:43:10 Fixed bug 2556 - add compilation flag -Wshadow Sylvain here's the full patch for Blit + RLE.
Sam Clegg 7e52722d 2014-06-20T11:10:16 Fix compiler warnings in Native Client and Linux builds.
Gabriel Jacobo 1e352d79 2014-06-06T15:45:59 Chrome's Native Client backend implementation
Brandon Schaefer 1f716769 2014-06-05T15:29:23 Fix warnings, only major one being an SDL_SetError not providing enough arguments.
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 ed02f61d 2014-03-13T00:40:08 Fixed the copyright date on files contributed by David Ludwig
David Ludwig b68b6e23 2014-03-12T11:57:15 Fixed various build and runtime errors when using WinRT with VS2012.
David Ludwig e8eb1427 2014-03-10T21:21:35 build fixes for most WinRT-related files Still TODO: getting the D3D11 renderer back up and running in VC 2012.
Sam Lantinga 1367bf87 2014-03-09T11:36:47 Integrated David Ludwig's support for Windows RT
Sam Lantinga 05c23063 2014-03-09T11:06:11 Fixed line endings on WinRT source code
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Ryan C. Gordon 090327e7 2013-12-09T16:03:18 Implemented the Dynamic API magic.
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
David Ludwig 7b5887b2 2013-11-28T22:24:13 WinRT: implemented SDL_DetachThread() for WinRT
David Ludwig 46740a5a 2013-11-28T22:09:21 WinRT: merged with latest SDL 2.x/HG code SDL 2.x recently accepted patches to enable OpenGL ES 2 support via Google's ANGLE library. The thought is to try to eventually merge SDL/WinRT's OpenGL code with SDL-official's.
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 7550ddcc 2013-11-13T22:35:26 Started BeOS removal: merged BeOS thread and pthread code. Haiku uses most of the standard pthread API, with a few #ifdefs where we still need to fallback onto the old BeOS APIs. BeOS, however, does not support pthreads (or maybe doesn't support it well), so I'm unplugging support for the platform with this changeset. Be Inc went out of business in 2001.
David Ludwig 69c5d21d 2013-10-27T21:26:46 WinRT: merged with SDL 2.0.1 codebase
Sam Lantinga f5fa492e 2013-10-20T20:42:55 Added a macro SDL_TICKS_PASSED() to correctly compare two 32-bit tick values. Went through the code and used the macro and fixed a couple places that were using incorrect timestamp comparisons.
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.
Sam Lantinga 10ffa28a 2013-09-06T20:45:08 Fixed time comparison and explicitly delay 1 ms instead of an arbitrary scheduled time.
Sam Lantinga 4b942c5a 2013-09-05T07:15:26 Fixed bug 2076 - OpenGL doesn't work with --disable-threads stepik-777 Thread local storage is used to store current window and current opengl context. OpenGL worked before this changeset: 7596 (45e5c263c096)
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 eec4710c 2013-08-29T14:03:44 Fixes bug #2074 - Thanks Sylvain! SDL_syssem.c:159 comparison of unsigned expression >= 0 is always true Solved by comparing unsigneds directly SDL_systimer.c:164: warning: control may reach end of Compile Solved by returning the default value if all else fails. SDL_androidgl.c:41:1: warning: type specifier missing, defaults to 'int' SDL_androidgl.c:47:1: warning: control reaches end of non-void function Solved by adding void return type to the function implementation
David Ludwig 73dfcdcf 2013-08-20T22:18:48 WinRT: removed some old debugging code from SDL_mutexP and SDL_mutexV
David Ludwig dcb1689f 2013-08-20T22:16:09 WinRT: made a note that WinRT doesn't appear to support modifying a thread's priority
David Ludwig 6300b360 2013-08-20T22:04:09 WinRT: made SDL_ThreadID() return the native thread ID, rather than a fake one
David Ludwig 90a9278f 2013-08-20T21:54:34 WinRT: made the C++11-based threading backend only try to catch exceptions that it knows it (the threading APIs) might throw, rather than all exceptions
David Ludwig d41fdc94 2013-08-13T20:09:52 WinRT: build fixes and additional WinRT-related integrations with SDL 2.0.0
David Ludwig f7049b93 2013-08-12T22:29:55 WinRT: merged with SDL 2.0.0 codebase (aka. SDL hg rev d4ce48ff30d1)
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.