src/thread/pthread


Log

Author Commit Date CI Message
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Sylvain Becker 252dc85e 2018-12-06T09:22:00 Fix warnings detected on Android build
Ryan C. Gordon 1689e9f9 2018-12-05T16:51:22 linux: Move SDL_LinuxSetThreadPriority() elsewhere to fix build. Fixes Bugzilla #4393.
Sylvain Becker 6259a726 2018-12-05T16:13:12 Warnings: fix a documentation warning and missing prototypes
Ryan C. Gordon c4bc59a5 2018-12-01T10:36:26 Patched to compile on Linux with --disable-threads. Fixes Bugzilla #4393.
Ryan C. Gordon 0ad4b0b6 2018-05-21T12:00:21 thread: fixed compiler warnings on non-Linux systems that use pthread. (static function rtkit_setpriority was unused, moved it in with rest of __LINUX__ section.)
Sam Lantinga 8f780e76 2018-04-23T22:17:56 Fixed build
Sam Lantinga f521b22e 2018-04-23T22:07:56 Added SDL_THREAD_PRIORITY_TIME_CRITICAL
Sam Lantinga a1b8fa60 2018-04-23T21:50:03 TryLockMutex: Fix error handling for TryLockMutex Christian Herzig pthread_mutex_trylock() and by the way, pthread_mutex_lock() do not set errno. Pthread-methods directly return error code as int. See related man-pages for details.
Sam Lantinga b5d231ee 2018-04-23T19:20:12 Handle NULL return from SDL_DBus_GetContext()
Sam Lantinga 43231256 2018-04-23T19:18:52 Added SDL_LinuxSetThreadPriority() to directly set the priority of a Linux thread (tid) This function tries using RealtimeKit connecting over DBUS as needed.
Sam Lantinga 816a6e68 2018-04-23T17:10:36 Added support for adjusting thread priorities using Linux RealtimeKit Michael Sartain This is a quick pass at adding Linux RealtimeKit thread priority support to SDL. It allows me to bump the thread priority to high without root privileges or setting any caps, etc. rtkit readme here: http://git.0pointer.net/rtkit.git/tree/README
Sam Lantinga f9f45d0b 2018-02-25T19:51:34 Fixed bug 4097 - Segmentation fault by SDL_CreateThreadWithStackSize Dongsun Kim Normal case 1. [thread 1] SDL_CreateThreadWithStackSize calls SDL_SYS_CreateThread. 2. [thread 1] If successful, it calls SDL_SemWait. 3. [thread 2] SDL_RunThread calls SDL_SYS_SetupThread, SDL_ThreadID, SDL_SemPost. 4. [thread 1] SDL_CreateThreadWithStackSize calls SDL_DestroySemaphore, SDL_free. Crash case (Segmentation fault) 1. [thread 1] SDL_CreateThreadWithStackSize calls SDL_SYS_CreateThread. 2. [thread 1] If successful, it calls SDL_SemWait. --> Error return due to SIGNAL(SYSTEM or Real Time) at sem_wait(pthread). 3. [thread 1] SDL_CreateThreadWithStackSize calls SDL_DestroySemaphore, SDL_free. 4. [thread 2] SDL_RunThread calls SDL_SYS_SetupThread, SDL_ThreadID, SDL_SemPost. --> Segmentation fault at strlen or sem_post.
Ryan C. Gordon 75a58303 2018-02-17T23:57:57 pthread: fix error code checks (thanks, Andreas!). Most pthread functions return 0 on success and non-zero on error, but those errors might be positive or negative, so checking for return values in the Unix style, where errors are less than zero, is a bug. Fixes Bugzilla #4039.
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
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 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
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
Ryan C. Gordon 7ae2951f 2016-04-12T14:38:50 threads: Handle SDL_HINT_THREAD_STACK_SIZE at top level, implement elsewhere.
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.
Philipp Wiesemann 98986f39 2015-08-15T21:21:29 Removed not needed call to pthread_attr_getstacksize() for SDL_CreateThread().
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 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 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 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 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.
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.
Sam Lantinga 10ffa28a 2013-09-06T20:45:08 Fixed time comparison and explicitly delay 1 ms instead of an arbitrary scheduled time.
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
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.