Sindbad~EG File Manager
�
(Μgq����ddlZddlZddlZddlZddlZddlZddlZddlmZd�Z d�Z
d�Zejdd��Z
dd�Zejdd��ZGd �d
�Zdefd�Ze�Zd
d�d�Zy)�N)�supportc�\�tj�ttj�fS�N)�_thread�_count�len� threading� _dangling���:/usr/local/lib/python3.12/test/support/threading_helper.py�threading_setuprs���>�>��S��!4�!4�5�5�5rc�b�|\}}d}tj|d��D]6}ttj�}tj�}||ks�6ydt_tjd|d�d|�d|�d �dt���
�|D]}tjd
|����y)Ng�?F��errorTz2threading_cleanup() failed to clean up threads in �.1fz seconds
before: thread count=z, dangling=z
after: thread count=zDangling thread: )
r�sleeping_retry�listr r
rr�environment_altered�
print_warningr)�original_values�
orig_count�orig_ndangling�timeout�_�dangling_threads�count�threads r
�threading_cleanuprs���!0��J���G�
�
#�
#�G�5�
9�� � � 3� 3�4����� ���J���:�#'�G�������c�]�"�",��[��8H�I!�!&��{�3�7G�3H�2I� K�L�
#����� 1�&��<�=�#rc�D�� tj���fd��}|S)Nc�N��t�} �|�t|�S#t|�wxYwr)rr)�args�key�funcs �r
� decoratorzreap_threads.<locals>.decorator>s)������ $���;��s�#���s�#�s��
$)� functools�wraps)r$r%s` r
�reap_threadsr(:s-�����_�_�T��$��$��rc#�K� |�tj}tj�} d��t j
�}tj|d��D]1}tj�tj�}||ks�1yt j
�|z
}d|z
�d|d�d|�d|�d� }t|��#t j
�}tj|d��D]1}tj�tj�}||ks�1wt j
�|z
}d|z
�d|d�d|�d|�d� }t|��xYw�w) NFrz!wait_threads() failed to cleanup z threads after rz seconds (count: z
, old count: �)) r�
SHORT_TIMEOUTrr�time� monotonicr�
gc_collect�AssertionError)r� old_count�
start_timerr�dt�msgs r
�wait_threads_exitr4Hsf��������'�'����� �I�&�
��^�^�%�
��'�'��u�=�A���� ��N�N�$�E�� �!�� >����!�J�.�B�6�u�y�7H�6I�J$�$&�s�8�,�#�W�M�)��A�?�C�!��%�%���^�^�%�
��'�'��u�=�A���� ��N�N�$�E�� �!�� >����!�J�.�B�6�u�y�7H�6I�J$�$&�s�8�,�#�W�M�)��A�?�C�!��%�%�s)�(E�C�AE�8E�AE� 8E�Ec�� |�tj}|j|�|j�rd|d�d�}t |��y)Nzfailed to join the thread in rz seconds)rr+�join�is_aliver/)rrr3s r
�join_threadr8ksO������'�'��
�K�K���
����-�g�c�]�(�C���S�!�!�rc#�8K� ddl}t|�}g} |D]#}|j�|j |��% d�� |r|�tj�}tdd�D]�}|dz
}|D]2}|jt|tj�z
d���4|D�cgc]}|j�s�|��}}|sn,t
js�ttdt|�|fz���|D�cgc]}|j�s�|��}}|r8|�|jt j"�t%dt|�z��y#t$rd}Y��^wxYw#t
jr"tdt|�t|�fz��xYwcc}wcc}w#|D�cgc]}|j�s�|��ncc}w}}|r8|�|jt j"�t%dt|�z��wxYw# |r|�tj�}tdd�D]�}|dz
}|D]2}|jt|tj�z
d���4|D�cgc]}|j�s�|��ncc}w}}|sn,t
js�ztdt|�|fz���|D�cgc]}|j�s�|��ncc}w}}|r8|�|jt j"�t%dt|�z��w#|D�cgc]}|j�s�|��ncc}w}}|r8|�|jt j"�t%dt|�z��wxYwxYw�w) Nrz/Can't start %d threads, only %d threads started���<g{�G�z�?z7Unable to join %d threads during a period of %d minuteszUnable to join %d threads)�faulthandler�ImportErrorr�start�appendr�verbose�printrr,r-�ranger6�maxr7�dump_traceback�sys�stdoutr/)�threads�unlockr=�started�t�endtimers r
�
start_threadsrMws?�������7�m�G��G�Q� ������ ����q�!�� � Q�����n�n�&�G� ��B�<���2�
�� �A��F�F�3�w����)9�9�4�@�A�!�&-�>�g������1�g��>����?�?��'�*-�g�,��)@�A�B�(�#*�:�'�Q�Q�Z�Z�\�q�'�G�:���+� �/�/��
�
�;�$�%@�3�w�<�%O�P�P���C������ �����G��7�|�S��\�2�3�4���?��;��'�:�'�Q�Q�Z�Z�\�q�'��:�G�:���+� �/�/��
�
�;�$�%@�3�w�<�%O�P�P���! Q�����n�n�&�G� ��B�<���2�
�� �A��F�F�3�w����)9�9�4�@�A�!�&-�>�g������1�g��>��>����?�?��'�*-�g�,��)@�A�B�(�#*�:�'�Q�Q�Z�Z�\�q�'��:�G�:���+� �/�/��
�
�;�$�%@�3�w�<�%O�P�P���#*�:�'�Q�Q�Z�Z�\�q�'��:�G�:���+� �/�/��
�
�;�$�%@�3�w�<�%O�P�P��s�N�E�
N�(E*�H�A,F,�1F"�F"�F,�"F,�=N�F'�F'�=N�E'�#N�&E'�'N�*5F�H�"F,�'N�,H�1G�G�AH�N�N�A,L2�?J
�J
�L2�6L2�N�K0�+K0�/AN�2N�7M�
M�AN�N�Nc�&�eZdZ d�Zd�Zd�Zd�Zy)�catch_threading_exceptionc�J�d|_d|_d|_d|_d|_yr)�exc_type� exc_value�
exc_tracebackr� _old_hook��selfs r
�__init__z"catch_threading_exception.__init__�s&����
����!��������rc��|j|_|j|_|j|_|j|_yr)rQrRrSr)rVr"s r
�_hookzcatch_threading_exception._hook�s1���
�
��
������!�/�/����k�k��rc�Z�tj|_|jt_|Sr)r �
excepthookrTrYrUs r
� __enter__z#catch_threading_exception.__enter__�s ��"�-�-���#�z�z� ���rc�>�|jt_|`|`|`|`yr)rTr r[rQrRrSr)rV�exc_infos r
�__exit__z"catch_threading_exception.__exit__�s#��#�~�~� ���M��N����KrN)�__name__�
__module__�__qualname__rWrYr\r_rrr
rOrO�s���<�"��
rrO�returnc�� tjdk(rtjjStjdk(ryy)N�
emscripten�wasiFT)rF�platform�_emscripten_info�pthreadsrrr
�_can_start_threadrj�s;�� ��|�|�|�#��#�#�,�,�,� ���� ��rF)�modulec�x� d}|rtstj|��ytjt|�S)Nzrequires threading support)�can_start_thread�unittest�SkipTest�
skipUnless)rkr3s r
�requires_working_threadingrq�s@���'�C�
���#�#�C�(�(� ��"�"�#3�S�9�9rr)r�
contextlibr&rFr r,rn�testrrrr(�contextmanagerr4r8rMrO�boolrjrmrqrrr
�<module>rvs������
�����6�>�<����&��&�D "����'Q��'Q�T6�6�r�4��&%�&��).�
:r
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists