multithreading

  1. R

    What's the possible result of the following code in concurrency situation?

    I have seen an interview question as below: What's the possible range of the result of the following code: void ThreadProc(int& sum) { for (int i = 1; i <= 50; i++) { sum += 1; } } int main() { int sum = 0; thread t1(ThreadProc, std::ref(sum)); thread...
Top