Name
acquire
Synopsis
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
.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.