]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
add IOLoop.clear_instance 1019/head
authorMinRK <benjaminrk@gmail.com>
Fri, 21 Mar 2014 17:59:25 +0000 (10:59 -0700)
committerMinRK <benjaminrk@gmail.com>
Fri, 21 Mar 2014 17:59:25 +0000 (10:59 -0700)
like clear_current, but for the global IOLoop instance

tornado/ioloop.py

index 80496e1933fe19d5c38f1afbe5c0ac6e5ced7c73..421bf8766596166ddd623595447ea25ce235e9de 100644 (file)
@@ -157,6 +157,12 @@ class IOLoop(Configurable):
         assert not IOLoop.initialized()
         IOLoop._instance = self
 
+    @staticmethod
+    def clear_instance():
+        """Clear the global `IOLoop` instance."""
+        if hasattr(IOLoop, "_instance"):
+            del IOLoop._instance
+
     @staticmethod
     def current():
         """Returns the current thread's `IOLoop`.