From 5b45b5851c5a66f0d04e3fbcb3bf05f4d7da7910 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 20 Jan 2019 13:00:20 +0000 Subject: [PATCH] issue #408: use compatible method to get thread ID. --- mitogen/core.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mitogen/core.py b/mitogen/core.py index 10336771..9bc11277 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -57,6 +57,11 @@ import imp # Absolute imports for <2.5. select = __import__('select') +try: + import thread +except ImportError: + import threading as thread + try: import cPickle as pickle except ImportError: @@ -1917,7 +1922,7 @@ class Latch(object): This disambiguates legitimate wake-ups, accidental writes to the FD, and buggy internal FD sharing. """ - ident = threading.currentThread().ident + ident = thread.get_ident() return b(u'%010d-%016x-%016x' % (os.getpid(), int(id(self)), ident)) COOKIE_SIZE = len(_make_cookie(None))