[docs] [issue14502] Document better what happens on releasing an unacquired lock
Jim Jewett
report at bugs.python.org
Fri Apr 6 21:37:14 CEST 2012
Jim Jewett <jimjjewett at gmail.com> added the comment:
On Fri, Apr 6, 2012 at 5:57 AM, Antoine Pitrou <report at bugs.python.org> wrote:
> Antoine Pitrou <pitrou at free.fr> added the comment:
>> > Not sure what you're talking about. The doc patch is about unacquired
>> > locks, not locks that someone else (another thread) holds.
>> Isn't one common reason for not being able to acquire a lock that
>> someone else was already holding it?
> We're talking about *releasing* an (un)acquired lock, not acquiring it
> again...
Right, but I thought the original motivation was concern over a race
condition in the lock acquisition.
lock.acquire()
try: # What if something happens here, during
try setup? Leak?
foo()
finally:
lock.release()
vs
try:
lock.acquire()
foo()
finally:
lock.release() # But what if the acquire failed?
-jJ
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14502>
_______________________________________
More information about the docs
mailing list