↧
Answer by ol202020 for How exactly does the wait function work wrt to...
Lets say we currently have number_of_cakes = 0, so Thread 2 is currently stuck on wait(rack_has_cakes). Thread 1 runs and increments number_of_cakes by 1. Then it calls signal(rack_has_cakes) - this...
View ArticleAnswer by Sam Varshavchik for How exactly does the wait function work wrt to...
thread 2 wakes up before Thread 1 calls unlock(some_lock), so it goes back to sleep again and the signal has been missed.No, that's not how it works. I will use C++std::condition_variable for my cite,...
View ArticleHow exactly does the wait function work wrt to condition variables
BackgroundI am somewhat confused about my understanding of how condition variables operate in conjunction with concurrent access to shared data. The following is pseudo code to depict my current...
View Article