0

Issue in atomic variable with threads

Hi Refer code below: https://www.sololearn.com/en/compiler-playground/c7hXZ2NZazcr It does not print any value even though I am printing count variable. However, if n is changes to 100, it works as expected. What is the issue or Am I missing something to be used with atomic?

11th May 2024, 7:31 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Answer
+ 2
Ketan Lalcheta works fine on external IDE (VSCode / Clion), it seems that sololearn's compiler times out when creating too many threads. n=10000 is still 100% passable while increasing it to n=10020 gives you 50% chance to have correct output/no output. n=10050 reduce this chance to 20% and the first run will always fail.
11th May 2024, 2:14 PM
Dawid Galuszka
Dawid Galuszka - avatar