Task 1
In the code below, vary the sleep time of Sleeper
to prevent undefined behavior.
Variation in the runtime with no synchronization results in undefined behavior.
The program has one serious issue: it has a data race and, therefore, undefined behavior. In simple words, a data race is a situation in which you have concurrent, non-synchronized read and write access to data. Do you spot the data race?
Get hands-on with 1200+ tech skills courses.