I am studying the gameloop used in Replica Island to understand a bit about Android game development. The main loop has the below logic...
GameThread.java (note the variable names in sample code dont match exact source code)
while (!finished) {
if (objectManager != null) {
renderer.waitDrawingComplete();
//Do more gameloop stuff after drawing is complete...
}
}
I was curious to see what waitDrawingComplete actually does, but found its just an empty syncrhonized method! I guess it does nothing, am I missing something here?
GameRenderer.java line 328
public synchronized void waitDrawingComplete() {
}
Source code can be checked out here with SVN if you feel like having a look: https://code.google.com/p/replicaisland/source/checkout
synchronized
keyword on waitDrawingComplete and thesynchronized(this)
in onDrawFrame. That's what ties them together, neither one can enter those synchronized parts of code until the other thread/s have exited the synchronized parts of code. – CiscoIPPhone May 29 '14 at 20:17