Details about condition variable and wait method

Hy guys,
I wanna ask you a question.

What happens at low level when a thread call wait method on a condition variable?

My idea is that one:
There is a token-queue for each and every thread that know the condition variable.

The cv.notifyall() in an insert in each and every queue of one token.
The cv.notifyone() in an insert in one casual queue of one token.

If a thread call cv.wait():

IF in it's own queue there is a token, wait have no effect.

IF there isn't token in it's own queue,it do
1
2
3
4
UNLOCK()
SLEEP UNTIL NOTIFY
LOCK()
 


It's correct?
Thanks in advance..
Last edited on
Topic archived. No new replies allowed.