a
    ø£Be.  ã                   @   s4   d Z ddlmZ ddlmZ dZG dd„ deƒZdS )úA thread for a control channel.é    )ÚThread)ÚIOLoopÚControlc                   @   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ti|¤Ž tdd�| _d| _d| _dS )zInitialize the thread.ÚnameF)Zmake_currentTN)r   Ú__init__ÚCONTROL_THREAD_NAMEr   Úio_loopZpydev_do_not_traceZis_pydev_daemon_thread)ÚselfÚkwargs© r   úT/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/ipykernel/control.pyr      s    zControlThread.__init__c                 C   s0   t | _z| j ¡  W | j ¡  n| j ¡  0 dS )zRun the thread.N)r	   r   r
   ÚstartÚclose©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   r   Ú<module>   s   