threadutil: explicitly import get_ident from thread

The python module thread is the low-level module we should avoid to use in favor
of threading. We still need it to support old python because Thread.ident
doesn't exist before python 2.6:

	http://docs.python.org/library/threading.html#threading.Thread.ident

Make it clear we should avoid it.

Reviewed-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht
2011-05-11 19:34:59 +02:00
parent 8a34edc8ca
commit d5493fe894
3 changed files with 8 additions and 10 deletions

View File

@ -19,7 +19,7 @@
from threading import Lock, Thread, BoundedSemaphore
from Queue import Queue, Empty
import traceback
import thread
from thread import get_ident # python < 2.6 support
import sys
from offlineimap.ui import getglobalui
@ -149,7 +149,6 @@ class ExitNotifyThread(Thread):
exited and to provide for the ability for it to find out why."""
def run(self):
global exitthreads, profiledir
self.threadid = thread.get_ident()
try:
if not profiledir: # normal case
Thread.run(self)
@ -164,7 +163,7 @@ class ExitNotifyThread(Thread):
except SystemExit:
pass
prof.dump_stats( \
profiledir + "/" + str(self.threadid) + "_" + \
profiledir + "/" + str(get_ident()) + "_" + \
self.getName() + ".prof")
except:
self.setExitCause('EXCEPTION')