March 2003
Intermediate to advanced
656 pages
39h 30m
English
acquire
L.acquire(wait=True)
When
wait is True,
acquire locks L. If
L is already locked, the calling thread
suspends and waits until L is unlocked,
then locks L. Even if the calling thread
was the one that last locked L, it still
suspends and waits until another thread releases
L. When wait is
False and L is
unlocked, acquire locks
L and returns True.
When wait is False and
L is locked, acquire
does not affect L, and returns
False.