![]() |
Rabbit Escape
2017-01-14_18:33:47_+0000__(tag:_v0.10.1)
|
Classes | |
class | Signal |
Public Member Functions | |
WorldSaver (World world, AndroidGameLaunch gameLaunch) | |
void | check () |
void | waitUnlessSaveSignal (long wait_time) |
String[] | waitUntilSaved () |
Public Attributes | |
String[] | savedWorld = null |
Private Member Functions | |
String[] | actuallySaveWorld () |
Private Attributes | |
final World | world |
final AndroidGameLaunch | gameLaunch |
final Signal | requestSave = new Signal() |
final Signal | saved = new Signal() |
boolean | saveWorld = false |
Hairy synchronization of the game loop, and the UI/system thread to ensure the world saves correctly.
Only the game loop can stop what it is doing to save the world, but it is the UI/system thread that asks for the saved world.
rabbitescape.ui.android.WorldSaver.WorldSaver | ( | World | world, |
AndroidGameLaunch | gameLaunch | ||
) |
|
private |
void rabbitescape.ui.android.WorldSaver.check | ( | ) |
Game loop thread: checks whether we've been asked to save the world, and if so, blocks here while it does it.
void rabbitescape.ui.android.WorldSaver.waitUnlessSaveSignal | ( | long | wait_time | ) |
Game loop thread: pauses the time supplied, but will be interrupted if the UI/system thread wakes us up by calling calls waitUntilSaved().
String [] rabbitescape.ui.android.WorldSaver.waitUntilSaved | ( | ) |
UI/system thread: requests a world save, wakes up the game loop if it is sleeping, then blocks until the game loop has saved the world, which it does by calling check().
|
private |
String [] rabbitescape.ui.android.WorldSaver.savedWorld = null |
|
private |
|
private |