§
    :FcaF  ã                   ó¬  — d Z ddlmZ ddlmZ ddlmZ ddlZg Z	g Z
eaej        Zej        Zd„ Zd„ Zd„ ZddlZd	ej        j	        v rC eed
¦  «        r7eej        _        e	                     d¦  «         e	                     d¦  «         n*e
                     d¦  «         e
                     d¦  «          ee e¦   «         e	e
z   d¬¦  «        Ze	e
z   ZdS )aj  
Cooperative implementation of special cases of :func:`signal.signal`.

This module is designed to work with libev's child watchers, as used
by default in :func:`gevent.os.fork` Note that each ``SIGCHLD``
handler will be run in a new greenlet when the signal is delivered
(just like :class:`gevent.hub.signal`)

The implementations in this module are only monkey patched if
:func:`gevent.os.waitpid` is being used (the default) and if
:const:`signal.SIGCHLD` is available; see :func:`gevent.os.fork` for
information on configuring this not to be the case for advanced uses.

.. versionadded:: 1.1b4
.. versionchanged:: 1.5a4
   Previously there was a backwards compatibility alias
   ``gevent.signal``, introduced in 1.1b4, that partly shadowed this
   module, confusing humans and static analysis tools alike. That alias
   has been removed. (See `gevent.signal_handler`.)
é    )Úabsolute_import)Ú_NONE)Úcopy_globalsNc                 óœ   — | t           j        k    rt          | ¦  «        S t          t          u rt          t           j        ¦  «        at          S )zÖ
    Exactly the same as :func:`signal.getsignal` except where
    :const:`signal.SIGCHLD` is concerned.

    For :const:`signal.SIGCHLD`, this cooperates with :func:`signal`
    to provide consistent answers.
    )Ú_signalÚSIGCHLDÚ_signal_getsignalÚ_child_handlerÚ_INITIAL)Ú	signalnums    ú//usr/lib/python3/dist-packages/gevent/signal.pyÚ	getsignalr   '   sA   € ð •G”OÒ#Ð#Ý  Ñ+Ô+Ð+õ �Ð!Ð!Ý*­7¬?Ñ;Ô;ˆåÐó    c                 ó†  — | t           j        k    rt          | |¦  «        S |t           j        k    r.|t           j        k    rt          |¦  «        st          d¦  «        ‚t          | ¦  «        }|a|t           j        t           j        fv r7ddl	m
} t          | |¦  «          |¦   «         j                             ¦   «          |S )aq  
    Exactly the same as :func:`signal.signal` except where
    :const:`signal.SIGCHLD` is concerned.

    .. note::

       A :const:`signal.SIGCHLD` handler installed with this function
       will only be triggered for children that are forked using
       :func:`gevent.os.fork` (:func:`gevent.os.fork_and_watch`);
       children forked before monkey patching, or otherwise by the raw
       :func:`os.fork`, will not trigger the handler installed by this
       function. (It's unlikely that a SIGCHLD handler installed with
       the builtin :func:`signal.signal` would be triggered either;
       libev typically overwrites such a handler at the C level. At
       the very least, it's full of race conditions.)

    .. note::

        Use of ``SIG_IGN`` and ``SIG_DFL`` may also have race conditions
        with libev child watchers and the :mod:`gevent.subprocess` module.

    .. versionchanged:: 1.2a1
         If ``SIG_IGN`` or ``SIG_DFL`` are used to ignore ``SIGCHLD``, a
         future use of ``gevent.subprocess`` and libev child watchers
         will once again work. However, on Python 2, use of ``os.popen``
         will fail.

    .. versionchanged:: 1.1rc2
         Allow using ``SIG_IGN`` and ``SIG_DFL`` to reset and ignore ``SIGCHLD``.
         However, this allows the possibility of a race condition if ``gevent.subprocess``
         had already been used.
    zKsignal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable objectr   )Úget_hub)r   r   Ú_signal_signalÚSIG_IGNÚSIG_DFLÚcallableÚ	TypeErrorr   r
   Ú
gevent.hubr   ÚloopÚreset_sigchld)r   ÚhandlerÚold_handlerr   s       r   Úsignalr   9   sÄ   € ðB •G”OÒ#Ð#Ý˜i¨Ñ1Ô1Ð1ð
 •'”/Ò!Ð! gµ´Ò&@Ð&@ÍÐRYÑIZÔIZÐ&@åÐeÑfÔfÐfå˜IÑ&Ô&€Kà€NØ•7”?¥G¤OÐ4Ð4Ð4ð
 	'Ð&Ð&Ð&Ð&Ð&Ý�y 'Ñ*Ô*Ð*Øˆ‰	Œ	Œ×$Ò$Ñ&Ô&Ð&ØÐr   c                  óž   — t          t          ¦  «        r8ddlm}   | t          t          j        d ¦  «        }|                     ¦   «          d S d S )Nr   )ÚGreenlet)r   r
   Úgeventr   r   r   Úswitch)r   Úgreenlets     r   Ú_on_child_hookr"   r   s[   € õ •ÑÔð à#Ð#Ð#Ð#Ð#Ð#Ø�8�N­G¬O¸TÑBÔBˆØ�ŠÑÔÐÐÐð	ð r   Úwaitpidr   r   r   © )Únames_to_ignoreÚdunder_names_to_keep)Ú__doc__Ú
__future__r   Úgevent._utilr   r   r   r   r   Ú__implements__Ú__extensions__r
   r   r   r	   r"   Ú	gevent.osr   ÚosÚhasattrÚappendÚglobalsÚ__imports__Ú__all__r$   r   r   ú<module>r3      sm  ððð ð* 'Ð &Ð &Ð &Ð &Ð &à *Ð *Ð *Ð *Ð *Ð *Ø %Ð %Ð %Ð %Ð %Ð %à Ð Ð Ð à€Ø€ð €à”€ØÔ%Ð ðð ð ð$6ð 6ð 6ðrð ð ð Ð Ð Ð à�”	Ô(Ð(Ð(¨W¨W°W¸iÑ-HÔ-HÐ(ð  .€F„IÔØ×Ò˜(Ñ#Ô#Ð#Ø×Ò˜+Ñ&Ô&Ð&Ð&ð ×Ò˜(Ñ#Ô#Ð#Ø×Ò˜+Ñ&Ô&Ð&àˆl˜7 G G¡I¤IØ+9¸NÑ+JØ02ð4ñ 4ô 4€ð ˜>Ñ
)€€€r   