TileCache's tile_retrieve is used for rendering tiles (which fetches tiles and also pushes into queue if not found).
Underlying Lifo datastructure is thread-safe but is a blunt mechanism since there is lots of locking/unlocking on sub-calls since curl multi logic also uses this same code (and thus locks).
Result is jagged dragging. #6 is one potential solution. Also another idea is to move mutex up to TileCache public functions itself and then remove thread-saftey/mutex logic from Lifo which would result in less intermittent locking.
Goal: as little locking on SDL rendering thread as possible.
Idea: integrate SDL loop & curl loop (FD/select) and then only run curl processing logic when SDL event queue empty
More or less solved. Mutex was moved up and locking is alot less noticeable currently.
Minor improvements can still be made / #6 will remain open