Android: create Pause/ResumeSem semaphore at higher level than CreateWindow()
- If you call onPause() before CreateWindow(), SDLThread will run in infinite loop in background. - If you call onPause() between a DestroyWindow() and a new CreateWindow(), semaphores are invalids. SDLActivity.java: the first resume() starts the SDLThread, don't call nativeResume() as it would post ResumeSem. And the first pause would automatically be resumed.
This commit is contained in:
parent
b3f07fa516
commit
91f11c320e
3 changed files with 39 additions and 20 deletions
|
@ -505,10 +505,14 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|||
mSDLThread = new Thread(new SDLMain(), "SDLThread");
|
||||
mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, true);
|
||||
mSDLThread.start();
|
||||
|
||||
// No nativeResume(), don't signal Android_ResumeSem
|
||||
mSurface.handleResume();
|
||||
} else {
|
||||
nativeResume();
|
||||
mSurface.handleResume();
|
||||
}
|
||||
|
||||
nativeResume();
|
||||
mSurface.handleResume();
|
||||
mCurrentNativeState = mNextNativeState;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue