I have a rather large, dynamic sparse matrix object class to write, and I want to make the following happen: one thread to handle placing elements into the matrix, and one to handle reading from the matrix.
The only time when these two would conflict would be when they would both want to access the same row/column at the same time. As such, I've decided that a simple mutex lock for each row/column is sufficient.
Now this is the first time I've actually done threading in C/C++, and I'd like to do it by the books, so to speak. I have two concerns.
If this is your first time to do multi-threading, use the Boost.Threads library. Its semantics (including synchronization mechanisms) are very straightforward and your implementation will be portable.
http://www.boost.org/doc/libs/1_42_0/doc/html/thread.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With