ext-SDL/include
Sam Lantinga 8077bf3d10 Fixed bug 2618 - incomplete pthread-based lock support should be removed
binarycrusader

Since changeset 358696c354a8, SDL 2.0 has been broken on Solaris when compiling with the Solaris Studio compiler (which uses the pthread implementation of SDL_AtomicLock).

Notably, it gets stuck at the MemoryBarrierRelease in SDL_GetErrBuf:

6585 # 218
6586     if (!tls_errbuf && !tls_being_created) {
6587          SDL_AtomicLock_REAL ( & tls_lock );
6588         if (!tls_errbuf) {
6589             SDL_TLSID slot;
6590             tls_being_created = SDL_TRUE;
6591             slot =  SDL_TLSCreate_REAL ( );
6592             tls_being_created = SDL_FALSE;
6593              { SDL_SpinLock _tmp = 0 ; SDL_AtomicLock_REAL ( & _tmp ) ; SDL_AtomicUnlock_REAL ( & _tmp ) ; };
^^^ loops forever above
6594             tls_errbuf = slot;
6595         }
6596          SDL_AtomicUnlock_REAL ( & tls_lock );
6597     }


Running: testthread
(process id 28926)
^Cdbx: warning: Interrupt ignored but forwarded to child.
signal INT (Interrupt) in __nanosleep at 0xfe52a875
0xfe52a875: __nanosleep+0x0015: jae      __nanosleep+0x23   [ 0xfe52a883, .+0xe ]
Current function is SDL_Delay_REAL
  204           was_error = nanosleep(&tv, &elapsed);
(dbx) where
  [1] __nanosleep(0xfeffe848, 0xfeffe850, 0xfe75a5ac, 0xfe5169d8), at 0xfe52a875
  [2] nanosleep(0xfeffe848, 0xfeffe850), at 0xfe516a3b
=>[3] SDL_Delay_REAL(ms = 0), line 204 in "SDL_systimer.c"
  [4] SDL_AtomicLock_REAL(lock = 0xfeffe88c), line 104 in "SDL_spinlock.c"
  [5] SDL_GetErrBuf(), line 225 in "SDL_thread.c"
  [6] SDL_ClearError_REAL(), line 216 in "SDL_error.c"
  [7] SDL_InitSubSystem_REAL(flags = 0), line 116 in "SDL.c"
  [8] SDL_Init_REAL(flags = 0), line 244 in "SDL.c"
  [9] SDL_Init(a = 0), line 89 in "SDL_dynapi_procs.h"
  [10] main(argc = 1, argv = 0xfeffe948), line 65 in "testthread.c"

As far as I can tell, this is because pthread_spin_trylock() always returns EBUSY for this particular lock; since it works in other places, I'm suspicious.

Different Solaris Studio compiler versions seem to make no difference.

I've verified this is broken on Linux as well if SDL_spinlock.c is modified to use the pthread implementation.

This appears to be because pthread_spin_init() and pthread_spin_destroy() are not used with the locks as required.
2014-07-07 21:27:42 -07:00
..
begin_code.h Fix compiler warnings in Native Client and Linux builds. 2014-06-20 11:10:16 -03:00
close_code.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
doxyfile Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_assert.h Chrome's Native Client backend implementation 2014-06-06 15:45:59 -03:00
SDL_atomic.h 2620 solaris port missing atomics if not using gcc 2014-07-05 16:11:23 -07:00
SDL_audio.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_bits.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_blendmode.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_clipboard.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_config_android.h Added SDL_sqrtf(), SDL_tan(), SDL_tanf() 2014-06-07 18:20:01 -07:00
SDL_config_iphoneos.h Fixed bug 2603 - iOS: update joystick accelerometer code to use CoreMotion instead of the deprecated UIAccelerometer 2014-06-25 00:20:21 -07:00
SDL_config_macosx.h Added SDL_sqrtf(), SDL_tan(), SDL_tanf() 2014-06-07 18:20:01 -07:00
SDL_config_minimal.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_config_pandora.h Added SDL_sqrtf(), SDL_tan(), SDL_tanf() 2014-06-07 18:20:01 -07:00
SDL_config_psp.h Added SDL_sqrtf(), SDL_tan(), SDL_tanf() 2014-06-07 18:20:01 -07:00
SDL_config_windows.h Split the XInput and DirectInput code so Windows RT can use the existing XInput support. 2014-07-03 15:39:55 -07:00
SDL_config_winrt.h Made the latest XInput + Haptic changes compile and run on WinRT 2014-07-04 18:20:23 -04:00
SDL_config_wiz.h Added SDL_sqrtf(), SDL_tan(), SDL_tanf() 2014-06-07 18:20:01 -07:00
SDL_config.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_config.h.cmake Fixed bug 2618 - incomplete pthread-based lock support should be removed 2014-07-07 21:27:42 -07:00
SDL_config.h.in Fixed bug 2618 - incomplete pthread-based lock support should be removed 2014-07-07 21:27:42 -07:00
SDL_copying.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_cpuinfo.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_egl.h SDL_egl: allow creation of versioned OpenGL contexts with EGL_KHR_create_context 2014-06-28 12:17:29 -03:00
SDL_endian.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_error.h Added annotations to help code analysis tools 2014-06-04 10:56:56 -07:00
SDL_events.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_filesystem.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_gamecontroller.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_gesture.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_haptic.h Fixed typo in header comment. 2014-05-11 15:59:22 +02:00
SDL_hints.h Fixed bug 2553 - Add support to all XInput devices 2014-06-24 13:31:25 -07:00
SDL_joystick.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_keyboard.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_keycode.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_loadso.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_log.h Added annotations to help code analysis tools 2014-06-04 10:56:56 -07:00
SDL_main.h Chrome's Native Client backend implementation 2014-06-06 15:45:59 -03:00
SDL_messagebox.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_mouse.h Merged Ryan's SDL-gui-backend branch. 2014-06-25 17:06:12 -04:00
SDL_mutex.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_name.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_opengl_glext.h Fixed Mac OS X build 2014-06-04 16:35:07 -07:00
SDL_opengl.h Fixed bug 2568 - NO_SDL_GLEXT should prevent OS glext.h as well 2014-06-15 17:37:35 -07:00
SDL_opengles2_gl2.h SDL_opengles2: Update to latest Khronos headers. 2014-06-04 01:35:36 -07:00
SDL_opengles2_gl2ext.h SDL_opengles2: Update to latest Khronos headers. 2014-06-04 01:35:36 -07:00
SDL_opengles2_gl2platform.h SDL_opengles2: Update to latest Khronos headers. 2014-06-04 01:35:36 -07:00
SDL_opengles2_khrplatform.h SDL_opengles2: Update to latest Khronos headers. 2014-06-04 01:35:36 -07:00
SDL_opengles2.h SDL_opengles2: Separate out GLES2 headers. 2014-06-04 01:27:13 -07:00
SDL_opengles.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_pixels.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_platform.h 2620 solaris port missing atomics if not using gcc 2014-07-05 16:11:23 -07:00
SDL_power.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_quit.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_rect.h Fixed using SDL_PointInRect() from C++. 2014-05-30 09:50:47 -04:00
SDL_render.h Render: Allow empty cliprect. 2014-04-19 13:15:41 -07:00
SDL_revision.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_rwops.h The NaCL mount/unmount functions need to be in SDL_system.h and specific to NaCL 2014-06-08 12:05:17 -07:00
SDL_scancode.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_shape.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_stdinc.h Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings 2014-06-23 11:06:50 -07:00
SDL_surface.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_system.h Initialize nacl_io, removes SDL_NaClMount/Umount 2014-06-20 10:59:51 -03:00
SDL_syswm.h Apply WIN32_LEAN_AND_MEAN redefine fix to SDL_syswm.h too. 2014-06-30 17:22:08 -07:00
SDL_test_assert.h Added annotations to help code analysis tools 2014-06-04 10:56:56 -07:00
SDL_test_common.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_test_compare.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_test_crc32.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_test_font.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_test_fuzzer.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_test_harness.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_test_images.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_test_log.h Added annotations to help code analysis tools 2014-06-04 10:56:56 -07:00
SDL_test_md5.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_test_random.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_test.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_thread.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_timer.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_touch.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_types.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_version.h Added a README file regarding WinRT support 2014-04-09 21:29:19 -04:00
SDL_video.h Added SDL_HITTEST_RESIZE_*, and implemented for X11. 2014-06-05 00:45:16 -04:00
SDL.h add a comment to SDL_InitSubSystem explaining its refcounting behavior 2014-07-03 10:22:26 -07:00