is_assignments/a2/code/.venv/lib/python3.10/site-packages/ipykernel/control.py

26 lines
613 B
Python
Raw Normal View History

2022-12-19 10:09:00 +01:00
from threading import Thread
from tornado.ioloop import IOLoop
class ControlThread(Thread):
def __init__(self, **kwargs):
Thread.__init__(self, name="Control", **kwargs)
self.io_loop = IOLoop(make_current=False)
self.pydev_do_not_trace = True
self.is_pydev_daemon_thread = True
def run(self):
self.name = "Control"
try:
self.io_loop.start()
finally:
self.io_loop.close()
def stop(self):
"""Stop the thread.
This method is threadsafe.
"""
self.io_loop.add_callback(self.io_loop.stop)