o
    ¹i	  ã                   @   sd   d Z ddlZejdkr(ddlZddlmZmZmZmZm	Z	 ddl
mZmZmZ nddlZdd„ ZdS )zè
Derived from

> https://github.com/rudolfwalter/pygdbmi/blob/0.7.4.2/pygdbmi/gdbcontroller.py
> MIT License  https://github.com/rudolfwalter/pygdbmi/blob/master/LICENSE
> Copyright (c) 2016 Chad Smith <grassfedcode <at> gmail.com>
é    NÚnt)ÚPOINTERÚWinErrorÚbyrefÚwindllÚwintypes)ÚBOOLÚDWORDÚHANDLEc                 C   sˆ   t jdkr9ttƒ}t d¡}tjj}t|||g|_	t
|_t |  ¡ ¡}tj |t|ƒdd¡}|dkr7ttƒ ƒ‚dS t | tjt j¡ dS )zÓ
    make file object non-blocking

    Windows doesn't have the fcntl module, but someone on
    stack overflow supplied this code as an answer, and it works
    http://stackoverflow.com/a/34504971/2893090
    r   é   Nr   )ÚosÚnamer   r	   r   r   Úkernel32ÚSetNamedPipeHandleStater
   Úargtypesr   ÚrestypeÚmsvcrtÚget_osfhandleÚfilenor   Ú
ValueErrorr   ÚfcntlÚF_SETFLÚ
O_NONBLOCK)Úfile_objÚLPDWORDÚPIPE_NOWAITr   ÚhÚres© r   úS/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/jupyter_lsp/non_blocking.pyÚmake_non_blocking   s   
	

ÿr    )Ú__doc__r   r   r   Úctypesr   r   r   r   r   Úctypes.wintypesr   r	   r
   r   r    r   r   r   r   Ú<module>   s    
