I'm trying to convert existing single thread flood fill algorithm(s) to multithread one(s).
Input: - 2d bit array and its dims - xy coords where fill should begin
Output: - same 2d bit array with updated bits
Problem: - only 1 thread at the time can write to given 64bits (8x8 pixels) in array, also no other thread can read this 64bits chunk at the write time
I've started with queue approach and thread pool so once thread finishes its job it can take another task from the queue.
How would you organize thread synchronization conforming 'problem' statement?
The main problem is how to assign read/write lockers to given memory chunk?