Re: Suspend worker thread when in background
"rtrussell" <[email protected]> Fri, 20 Jan 2017 00:24:37 +0000
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <[email protected]> |
Daniel Gibson wrote: > Even if it takes like a second until all threads are suspended (or maybe even a few seconds?) that shouldn't be a problem? Shouldn't it? This is what the SDL docs say about the app events (https://wiki.libsdl.org/SDL_EventType#Android.2C_iOS_and_WinRT_Events): "These events must be handled in an event filter, since often the OS needs an immediate response and will terminate your process shortly after sending the event, and if it sits in the SDL event queue, it'll be too late". I interpreted this as meaning that the app must respond in less than a frame period (which is typically how long an SDL app might take before checking the event queue), so even a few milliseconds might be too long. When I trace the crashes with logcat I see my worker thread trying to access memory that Android has already 'paged out' whilst putting my app into the background. Subjectively this is happening 'instantly', not after a few seconds. Richard. _______________________________________________ SDL mailing list [email protected] http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org