[tor-commits] [stem/master] Using theading's currrentThead() rather than current_thread()

atagar at torproject.org atagar at torproject.org
Mon Jun 25 01:45:01 UTC 2012


commit 60b0e8ba06a03e5ae1664959c2f9e1552f224b39
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Jun 21 09:40:00 2012 -0700

    Using theading's currrentThead() rather than current_thread()
    
    The threading module's current_thead() function isn't availalbe in python 2.5.
    It isn't documented, but there seems to have been a mass aliasing in 2.6 to the
    underscore convention so using that instead.
---
 stem/control.py |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index 4e6e4f2..9c5c515 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -54,11 +54,9 @@ State = stem.util.enum.Enum("INIT", "RESET", "CLOSED")
 
 UNDEFINED = "<Undefined_ >"
 
-# TODO: The Thread's isAlive() method was changed to the more conventional
-# is_alive() in python 2.6 and above. We should use that when dropping python
-# 2.5 compatability...
-# http://docs.python.org/library/threading.html#threading.Thread.is_alive
-# http://bugs.python.org/issue15126
+# TODO: The Thread's isAlive() method and theading's currentThread() was
+# changed to the more conventional is_alive() and current_thread() in python
+# 2.6 and above. We should use that when dropping python 2.5 compatability.
 
 class BaseController:
   """
@@ -288,7 +286,7 @@ class BaseController:
     # joins on our threads if it's safe to do so
     
     for t in (self._reader_thread, self._event_thread):
-      if t and t.isAlive() and threading.current_thread() != t:
+      if t and t.isAlive() and threading.currentThread() != t:
         t.join()
     
     self._notify_status_listeners(State.CLOSED, False)





More information about the tor-commits mailing list