open a separate openside_t for every read thread to try to get some
parallelism in decode
works, but no faster overall, since we don't ensure that each osr tile
is only fetched once --- threads need to synchronise and not overlap
we need:
- some way to get tile geometry from osr
- a threaded tilecache aligned to the osr tile boundaries
the tilecache needs to have locks and semaphores on every tile,
something like:
class tilecache:
def generate(region):
# lock all tiles we need, make a list of the ones that need
# calculating
work = []
for tile in region:
tile.lock()
if tile.nodata():
work.append(tile)
tile.set(:in-progress)
# calculate all empty tiles we need
for tile in work:
tile.calculate()
tile.set(:data)
# some tiles may be being made by another thread,
# wait for them to be done
for tile in region:
if tile.in-progress:
tile.wait()
# should all have data now, paste to output and unlock
for tile in region:
tile.paste(output)
tile.unlock()
return output