Quantcast
Channel: Parallel Computing in C++ and Native Code forum
Viewing all articles
Browse latest Browse all 856

Right way (&simple) to do thread-safe access to variable from multiple threads (C++ (/ CX))

$
0
0

What is the best practice for thread-safe access to variable in WinRT.

Let say I have 100 threads that upon completion each increments one and the same counter (sure it's very simple example that can be done other way around, but I choose it just for the sake of the example).

How shall I implement the thread-safety so to not be data race condition?

Searching only for C++(/CX) example.


Viewing all articles
Browse latest Browse all 856