]> granicus.if.org Git - python/commitdiff
In _DummyThread objects the lock stored in __block (allocated thanks to
authorBrett Cannon <bcannon@gmail.com>
Sat, 8 Jan 2005 02:43:53 +0000 (02:43 +0000)
committerBrett Cannon <bcannon@gmail.com>
Sat, 8 Jan 2005 02:43:53 +0000 (02:43 +0000)
_Thread.__init__) was never used.  This is a waste since locks use OS
primitives that are in limited supply.  So the lock is deleted in
_DummyThread.__init__ .

Closes bug #1089632.

Lib/threading.py
Misc/NEWS

index 860c2fdd33c442b513f7ae9e95a8cbbb1216f80f..61c25b65344434e4da0fe3f36275c78eb56dfbd7 100644 (file)
@@ -653,6 +653,7 @@ class _DummyThread(Thread):
 
     def __init__(self):
         Thread.__init__(self, name=_newname("Dummy-%d"))
+        del self._Thread__block
         self._Thread__started = True
         _active_limbo_lock.acquire()
         _active[_get_ident()] = self
index d7b35d51678294e276e5a0608951170cf79e87bf..8d00f22a6436c3e6e5946a4cfd1766b8e3e22be9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -33,6 +33,11 @@ Extension Modules
 Library
 -------
 
+- _DummyThread objects in the threading module now delete self.__block that is
+  inherited from _Thread since it uses up a lock allocated by 'thread'.  The
+  lock primitives tend to be limited in number and thus should not be wasted on
+  a _DummyThread object.  Fixes bug #1089632.
+
 - The imghdr module now detects Exif files.
 
 - StringIO.truncate() now correctly adjusts the size attribute.