Re: Suspend worker thread when in background
Daniel Gibson <[email protected]> Fri, 20 Jan 2017 00:00:32 +0100
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <[email protected]> |
You could use https://wiki.libsdl.org/SDL_CondWait in the worker threads and signal the condition variable on SDL_APP_WILLENTERFOREGROUND event so the worker threads continue running. (Probably only call SDL_CondWait() if some global bool variable you set on WILLENTERBACKGROUND is true - remember to set it back to false on WILLENTERFOREGROUND) Cheers, Daniel On 18.01.2017 05:34, rtrussell wrote: > I create a worker thread using SDL_CreateThread and on Android I need to > be able to suspend that thread on an SDL_APP_WILLENTERBACKGROUND event. > Unfortunately there doesn't seem to be a SDL_SuspendThread or similar > function. This must be a common problem so what is the solution? > > Richard. >