U
    ҥc                     @   s0   d Z ddlmZ ddlmZ G dd deZdS )A thread for a control channel.    )Thread)IOLoopc                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	ControlThreadr   c                 K   s2   t j| fddi| tdd| _d| _d| _dS )zInitialize the thread.nameControlF)Zmake_currentTN)r   __init__r   io_loopZpydev_do_not_traceZis_pydev_daemon_thread)selfkwargs r   0lib/python3.8/site-packages/ipykernel/control.pyr   
   s    zControlThread.__init__c                 C   s&   d| _ z| j  W 5 | j  X dS )zRun the thread.r   N)r   r	   closestartr
   r   r   r   run   s    zControlThread.runc                 C   s   | j | j j dS )z=Stop the thread.

        This method is threadsafe.
        N)r	   Zadd_callbackstopr   r   r   r   r      s    zControlThread.stopN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r      s   r   N)r   	threadingr   Ztornado.ioloopr   r   r   r   r   r   <module>   s   