This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author fionalim
Recipients
Date 2002-03-28.02:02:38
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
According to the online documentation for threading
Lock objects, setting blocking=0 will produce a
non-blocking call.
But trying it in the command line causes the execution
to hang.
>>> import threading
>>> lock = threading.Lock()
>>> lock.acquire(blocking=0)
>>> lock.acquire(blocking=0)
[blocks]

----------------------------------
internal documentation claims that the keyword is wait,
but using wait produces the same problem:

>>> import threading
>>> lock = threading.Lock()
>>> lock.acquire.__doc__
'acquire([wait]) -> None or
Boolean\n(PyThread_acquire_lock() is an obsolete
synonym)\n\nLock the lock.  Without argument, this
blocks if the lock is already\nlocked (even by the same
thread), waiting for another thread to release\nthe
lock, and return None when the lock is acquired.\nWith
a Boolean argument, this will only block if the
argument is true,\nand the return value reflects
whether the lock is acquired.\nThe blocking operation
is not interruptible.'
>>> lock.acquire(wait=0)
>>> lock.acquire(wait=0)
[blocks]

---------------------------------
Not using a keyword works fine:
>>> import threading
>>> lock = threading.Lock()
>>> lock.acquire(0)
1
>>> lock.acquire(0)
0
>>> 

History
Date User Action Args
2007-08-23 14:00:16adminlinkissue536017 messages
2007-08-23 14:00:16admincreate