File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ def watch(self, callback):
5656 """
5757 raise NotImplementedError
5858
59+ def watching (self ):
60+ """Is the current thread being watched for death?"""
61+ return self .get () in self ._refs
62+
5963
6064class ThreadIdent (Ident ):
6165 class _DummyLock (object ):
@@ -99,15 +103,6 @@ def watch(self, callback):
99103 vigil = self ._make_vigil ()
100104 self ._refs [id (vigil )] = weakref .ref (vigil , callback )
101105
102- def watching (self ):
103- """Is the current thread being watched for death?"""
104- tid = self .get ()
105- if tid not in self ._refs :
106- return False
107- # Check that the weakref is active, if not the thread has died
108- # This fixes the case where a thread id gets reused
109- return self ._refs [tid ]()
110-
111106
112107class GreenletIdent (Ident ):
113108 def get (self ):
You can’t perform that action at this time.
0 commit comments