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.
Created on 2002年03月28日 02:02 by fionalim, last changed 2022年04月10日 16:05 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg10077 - (view) | Author: Fiona Lim (fionalim) | Date: 2002年03月28日 02:02 | |
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 >>> |
|||
| msg10078 - (view) | Author: Tim Peters (tim.peters) * (Python committer) | Date: 2002年03月28日 03:31 | |
Logged In: YES user_id=31435 Changed to docs and assigned to Fred for comment. Any idea how we can make this clearer? The docs don't claim this accepts a keyword argument, and lots of C functions simply ignore any keyword arguments that may be given. |
|||
| msg10079 - (view) | Author: Martin v. Löwis (loewis) * (Python committer) | Date: 2002年03月28日 10:33 | |
Logged In: YES user_id=21627 This is fixed in Python 2.2; it will raise an exception "acquire() takes no keyword arguments". That should make it immediately clear how to read the documentation. |
|||
| msg10080 - (view) | Author: Tim Peters (tim.peters) * (Python committer) | Date: 2002年03月31日 18:30 | |
Logged In: YES user_id=31435 Thanks, Martin! Since this is already much better in 2.2, I'll take responsibility for closing it as Fixed. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月10日 16:05:10 | admin | set | github: 36342 |
| 2002年03月28日 02:02:38 | fionalim | create | |