I need some help dealing with three Threads in Android
One thread is the main thread, the other is the GLThread, and the other is a WorkerThread I created to update the game state.
The problem I have is they all need to access the same LinkedList of game objects. Both the GLThread and my WorkerThread only read from the LinkedList, so no problem there, but occasionally I have the main thread adding in another game object to the list.
How can I manage this? I tried using synchronized in front of the functions involved but it really slows down the application.
For some reason, just catching the errors and not rendering or updating the game state that frame, causes it to start lagging permanently.
Anyone have any great ideas?