o
    ™©Zhì  ã                   @   s<   d Z ddlZddlmZ defdd„Zdeddfdd	„ZdS )
z»Use a Windows event to interrupt a child process like SIGINT.

The child needs to explicitly listen for this - see
ipykernel.parentpoller.ParentPollerWindows for a Python implementation.
é    N)ÚAnyÚreturnc                  C   sN   G dd„ dt jƒ} | ƒ }t  |¡}t  | ¡|_d|_d|_t jj 	|ddd¡S )zýCreate an interrupt event handle.

    The parent process should call this to create the
    interrupt event that is passed to the child process. It should store
    this handle and use it with ``send_interrupt`` to interrupt the child
    process.
    c                   @   s(   e Zd ZdejfdejfdejfgZdS )z3create_interrupt_event.<locals>.SECURITY_ATTRIBUTESÚnLengthÚlpSecurityDescriptorÚbInheritHandleN)Ú__name__Ú
__module__Ú__qualname__ÚctypesÚc_intZc_void_pZ_fields_© r   r   úS/var/www/html/lang_env/lib/python3.10/site-packages/jupyter_client/win_interrupt.pyÚSECURITY_ATTRIBUTES   s
    ýr   r   é   FÚ )
r
   Z	StructureZpointerZsizeofr   r   r   ÚwindllÚkernel32ZCreateEventA)r   ÚsaZsa_pr   r   r   Úcreate_interrupt_event
   s   
ür   Úinterrupt_handlec                 C   s   t jj | ¡ dS )z4Sends an interrupt event using the specified handle.N)r
   r   r   ZSetEvent)r   r   r   r   Úsend_interrupt+   s   r   )Ú__doc__r
   Útypingr   r   r   r   r   r   r   Ú<module>   s
    !