How to multiply a matrix by a vector using mutex on C ++ Matrix and vector are set randomly
- 3How to open a file using a chocolate tube? How to cook soup, if you read "War and Peace"? - VladD
- @ alishka193, and why with this multiplication (if, of course, the result is already a selected vector) do you need mutex at all? After all, each thread processes independent data (which data can be passed in parameters). - Judging by the wording of the question, I do not think that this is a question of managing a pool of “multiplier” streams. - avp
|
1 answer
For example, something like this:
mutex.lock(); try { // вычисления mutex.unlock(); } catch(...) { mutex.unlock(); throw; } - oneWhere is RAII? - KoVadim
- one@Free_ze: Why manually? {std :: lock_guard <std :: mutex> lock (mutex); // calculations} - VladD
- @KoVadim RAII is not there now, come back later) @VladD Consider this as pseudo-code, since About the implementation of the vehicle did not say anything. It would be worthwhile to write based on C ++ 11, as you have brought, but I do not know him, I repent) - free_ze
- Better like this: {std :: unique_lock <std :: mutex> lock (mutex); // calculations} - dzhioev
|