First of all, you do not need a mutex for each column and one per line. If you purchased a mutex for a row, you blocked all the cells in that row, so it doesn't matter which column you are accessing. Or, if you get a lock for a column, you locked all the cells in these columns, it doesn't matter which row. Thus, you can have a mutex per table, one per cell, one per row, or one per column. But one per line and one per column does not make sense.
Most synchronization primitives block your threads, and the thread will simply resume when the resource becomes free, you donโt need to worry about signaling and waking up. This part is exactly what a synchronization object, such as a mutex or critical section, is for you.
The specifics of building and using synchronization primitives vary by platform. As others have already written, there are cross-platform libraries that you can use, but you must indicate which platform you are targeting, at least so that we know which libraries are available.
source share