waler
Help with Multithreading
I'll read the document first and probably go back to the example you gave, all I understand as of now is there might be multiple threads that read and write the value of counter at the same time, which is why we did not get 10000 as a result.
38 replies
Help with Multithreading
hmmm I see, so the real reason was because of a race condition that was bound to happen, if I maybe did something like making the main thread sleep for a bit after assign a new thread to the threads array, can this avoid the race condition potentially happening?
38 replies