Ray.Allen <ysj....@gmail.com> added the comment: Hi,
krisvale: > Since the exact mechanics seem to be unclair to many, let me just step you > through the series of events. > 1) A has the lock, B is waiting for it. the bit is "set". > 2) A releases the lock: Clears the bit, signals the condition variable. > 3) A tries to immediately reacquire the lock. Sees the bit cleared, sets it, > and claims the lock. > 4) B wakes up from the condition variable. Sees the bit "set" and goes back > to sleep. It has lost the race to A. I don't quite understand the four steps you explained. After the time of step 2, B is going to waken up and acquire the lock, and at the same time A returns from release function and is going to reacquire the lock. Who is scheduled first after A signals the condition variable is not predictable. So why does A always acquire the lock? Thanks! ---------- nosy: +ysj.ray _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8410> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com