Why do condition variables sometimes erroneously wake up?
Posted
by aspo
on Stack Overflow
See other posts from Stack Overflow
or by aspo
Published on 2010-04-28T06:24:18Z
Indexed on
2010/04/28
6:33 UTC
Read the original article
Hit count: 285
concurrency
|condition-variables
I've known for eons that the way you use a condition variable is
lock
while not task_done
wait on condition variable
unlock
Because sometimes condition variables will spontaneously wake. But I've never understood why that's the case. In the past I've read it's expensive to make a condition variable that doesn't have that behavior, but nothing more than that.
So... why do you need to worry about falsely being woken up when waiting on a condition variable?
© Stack Overflow or respective owner