[New-bugs-announce] [issue24411] Drop redundant lock in queue.Queue methods qsize(), empty() and full()
Andrew Svetlov
report at bugs.python.org
Mon Jun 8 20:15:29 CEST 2015
New submission from Andrew Svetlov:
Now those methods use lock for querying queue size, like
def qsize(self):
with self.mutex:
return self._qsize()
The lock is not necessary because thread context switch may be done *after* returning from mutex protected code but *before* getting result by calling side.
All three methods (qsize(), empty() and full()) gives *approximated value*, so getting rid of lock doesn't make it less stringent.
----------
components: Library (Lib)
messages: 245029
nosy: asvetlov
priority: low
severity: normal
status: open
title: Drop redundant lock in queue.Queue methods qsize(), empty() and full()
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24411>
_______________________________________
More information about the New-bugs-announce
mailing list