My problem: I have a block matrix updated with multiple threads. Multiple threads may update a non-overlapping block at a time, but overall there may be race conditions. the matrix is now locked using a single lock.
The question is, is it possible (and if so, how?) To implement an effective array of locks, so that only parts of the matrix can be locked at a time.
The matrix in question can be quite large, of the order of 50 ^ 2 blocks. my initial guess is to dynamically highlight a mutex vector / map.
Is this a good approach? Is it better to use several variable conditions? is there a better approach?
thanks
source share