Is Android SDL_WaitThread ever safe to call?

On Android, SDL_DetachThread() calls DetachCurrentThread() as is required
to avoid a resource leak.

However, if you use SDL_WaitThread(), DetachCurrentThread() is never called
and the resource leaks.

Calling SDL_DetachThread() after SDL_WaitThread() returns has “undefined
results”. So then, how do I avoid resource leaks with SDL_WaitThread?

Is SDL_WaitThread() ever safe to call on Android?

Michael Labbe

Sure that isn’t just a bug in SDL_WaitThread on Android, then?

2015-10-13 2:25 GMT-03:00, Michael Labbe :> On Android, SDL_DetachThread() calls DetachCurrentThread() as is required

to avoid a resource leak.

However, if you use SDL_WaitThread(), DetachCurrentThread() is never called
and the resource leaks.

Calling SDL_DetachThread() after SDL_WaitThread() returns has “undefined
results”. So then, how do I avoid resource leaks with SDL_WaitThread?

Is SDL_WaitThread() ever safe to call on Android?

Michael Labbe

Yep, a bug. SDL_WaitThread() is intended to clean up the dead thread. Its
use is mutually exclusive to SDL_DetachThread().

Jonny DOn Tue, Oct 13, 2015 at 9:49 AM, Sik the hedgehog < sik.the.hedgehog at gmail.com> wrote:

Sure that isn’t just a bug in SDL_WaitThread on Android, then?

2015-10-13 2:25 GMT-03:00, Michael Labbe :

On Android, SDL_DetachThread() calls DetachCurrentThread() as is required
to avoid a resource leak.

However, if you use SDL_WaitThread(), DetachCurrentThread() is never
called
and the resource leaks.

Calling SDL_DetachThread() after SDL_WaitThread() returns has “undefined
results”. So then, how do I avoid resource leaks with SDL_WaitThread?

Is SDL_WaitThread() ever safe to call on Android?

Michael Labbe


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

False alarm, sorry guys. Long day.

I added a couple of logging messages to Android_JNI_ThreadDestroyed() and I
confirmed that the threads ARE being destroyed by SDL_WaitThread and that
there is no leak.

Android spams this message:

Native thread exiting without having called DetachCurrentThread (maybe it’s
going to use a pthread_key_create destructor?)

Well, pthread_key_create’s destructor IS being called.On Tue, Oct 13, 2015 at 6:55 AM, Jonathan Dearborn wrote:

Yep, a bug. SDL_WaitThread() is intended to clean up the dead thread.
Its use is mutually exclusive to SDL_DetachThread().

Jonny D

On Tue, Oct 13, 2015 at 9:49 AM, Sik the hedgehog < sik.the.hedgehog at gmail.com> wrote:

Sure that isn’t just a bug in SDL_WaitThread on Android, then?

2015-10-13 2:25 GMT-03:00, Michael Labbe <@Michael_Labbe>:

On Android, SDL_DetachThread() calls DetachCurrentThread() as is
required
to avoid a resource leak.

However, if you use SDL_WaitThread(), DetachCurrentThread() is never
called
and the resource leaks.

Calling SDL_DetachThread() after SDL_WaitThread() returns has “undefined
results”. So then, how do I avoid resource leaks with SDL_WaitThread?

Is SDL_WaitThread() ever safe to call on Android?

Michael Labbe


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org