AlkantarClanX12

Your IP : 3.141.35.27


Current Path : /opt/alt/python311/lib64/python3.11/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/multiprocessing/__pycache__/synchronize.cpython-311.pyc

�

c��f�/����gd�ZddlZddlZddlZddlZddlZddlmZddlmZddlm	Z		ddlm
Z
mZn#e$red���wxYwe
ed	����\ZZej
jZGd
�de��Z
Gd�d
e
��ZGd�de��ZGd�de
��ZGd�de
��ZGd�de��ZGd�de��ZGd�dej��ZdS))�Lock�RLock�	Semaphore�BoundedSemaphore�	Condition�Event�N�)�context)�process)�util)�SemLock�
sem_unlinkz�This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.�c�|�eZdZej��Zd�Zed���Zd�Z	d�Z
d�Zd�Zd�Z
ed���Zd	S)
r
c���|�tj���}|���dk|_t
jdkp|j}td��D]E}	tj	||||�
��|��x}|_n#t$rY�BwxYwtd���tjd|jz��|���t
jdkrd�}tj||��|jj�Kddlm}	|	|jjd	��tj|tj|jjfd
���dSdS)N�fork�win32�dzcannot find name for semaphorezcreated semlock with handle %sc�8�|j���dS�N)�_semlock�_after_fork)�objs �B/opt/alt/python311/lib64/python3.11/multiprocessing/synchronize.pyrz%SemLock.__init__.<locals>._after_forkGs����(�(�*�*�*�*�*�r	)�register�	semaphorer)�exitpriority)r
�_default_context�get_context�get_start_method�_is_fork_ctx�sys�platform�range�_multiprocessingr
�
_make_namer�FileExistsErrorr�debug�handle�
_make_methods�register_after_fork�name�resource_trackerr�Finalize�_cleanup)
�self�kind�value�maxvalue�ctx�
unlink_now�i�slrrs
          r�__init__zSemLock.__init__2s����;��*�6�6�8�8�C��0�0�2�2�f�<����\�W�,�A��0A�
��s���
	D�
	D�A�
�%5�%=��%��4�?�?�+<�+<��& �& � ��T�]����#�
�
�
���
����
"�"B�C�C�C��
�3�b�i�?�@�@�@��������<�7�"�"�
+�
+�
+��$�T�;�7�7�7��=��)�
3�2�2�2�2�2��H�T�]�'��5�5�5��M�$�� 0�4�=�3E�2G�'(�
*�
*�
*�
*�
*�
*�
*�)s�'1B�
B'�&B'c�H�ddlm}t|��||d��dS)Nr	)�
unregisterr)r.r;r)r-r;s  rr0zSemLock._cleanupTs:��0�0�0�0�0�0��4�����
�4��%�%�%�%�%rc�J�|jj|_|jj|_dSr)r�acquire�release�r1s rr+zSemLock._make_methodsZs���}�,����}�,����rc�4�|j���Sr)r�	__enter__r?s rrAzSemLock.__enter__^s���}�&�&�(�(�(rc� �|jj|�Sr)r�__exit__�r1�argss  rrCzSemLock.__exit__as��%�t�}�%�t�,�,rc��tj|��|j}tjdkr,tj���|j��}n|jrtd���|j}||j
|j|jfS)Nrz�A SemLock created in a fork context is being shared with a process in a spawn context. This is not supported. Please use the same context to create multiprocessing objects and Process.)
r
�assert_spawningrr#r$�get_spawning_popen�duplicate_for_childr*r"�RuntimeErrorr2r4r-)r1r8�hs   r�__getstate__zSemLock.__getstate__ds������%�%�%�
�]���<�7�"�"��*�,�,�@�@���K�K�A�A�� �
K�"�$J�K�K�K��	�A��2�7�B�K���1�1rc��tjj|�|_t	jd|dz��|���d|_dS)Nz recreated blocker with handle %rrF)r&r
�_rebuildrrr)r+r"�r1�states  r�__setstate__zSemLock.__setstate__rsN��(�0�9�5�A��
��
�5��a��@�A�A�A�������!����rc�v�tj��jd�dttj����S)N�	semprefix�-)r�current_process�_config�nextr
�_rand�rrr'zSemLock._make_nameys6��!�1�3�3�;�K�H�H�H��w�}�-�-�-�/�	/rN)�__name__�
__module__�__qualname__�tempfile�_RandomNameSequencerXr9�staticmethodr0r+rArCrLrQr'rYrrr
r
.s�������(�H�(�*�*�E� *� *� *�D�&�&��\�&�
-�-�-�)�)�)�-�-�-�2�2�2�"�"�"��/�/��\�/�/�/rr
c�"�eZdZdd�Zd�Zd�ZdS)rr	c�L�tj|t|t|���dS�N�r5)r
r9�	SEMAPHORE�
SEM_VALUE_MAX�r1r3r5s   rr9zSemaphore.__init__�s$�����y�%��C�H�H�H�H�H�Hrc�4�|j���Sr)r�
_get_valuer?s r�	get_valuezSemaphore.get_value�s���}�'�'�)�)�)rc��	|j���}n#t$rd}YnwxYwd|jj�d|�d�S)N�unknown�<�(value=�)>)rrh�	Exception�	__class__rZ�r1r3s  r�__repr__zSemaphore.__repr__�s[��	��M�,�,�.�.�E�E���	�	�	��E�E�E�	�����#'�>�#:�#:�#:�E�E�E�B�B���+�+N�r	)rZr[r\r9rirrrYrrrr�sO������I�I�I�I�*�*�*�C�C�C�C�Crrc��eZdZdd�Zd�ZdS)rr	c�B�tj|t|||���dSrb�r
r9rdrfs   rr9zBoundedSemaphore.__init__�s$�����y�%��C�@�@�@�@�@�@rc��	|j���}n#t$rd}YnwxYwd|jj�d|�d|jj�d�S)Nrkrlrmz, maxvalue=rn)rrhrorprZr4rqs  rrrzBoundedSemaphore.__repr__�sp��	��M�,�,�.�.�E�E���	�	�	��E�E�E�	�������'�'�'�����
�0F�0F�0F�H�	HrsNrt�rZr[r\r9rrrYrrrr�s@������A�A�A�A�H�H�H�H�Hrrc��eZdZd�Zd�ZdS)rc�B�tj|tdd|���dS�Nr	rcrw�r1r5s  rr9z
Lock.__init__�s$�����y�!�Q�C�8�8�8�8�8�8rc��	|j���rStj��j}tj��jdkr|dtj��jzz
}nB|j���dkrd}n"|j���dkrd}nd}n#t$rd}YnwxYwd	|j
j�d
|�d�S)N�
MainThread�|r	�Noner�SomeOtherThread�SomeOtherProcessrkrlz(owner=rn)r�_is_minerrUr-�	threading�current_threadrh�_countrorprZ)r1r-s  rrrz
Lock.__repr__�s���	��}�%�%�'�'�	
*��.�0�0�5���+�-�-�2�l�B�B��C�)�":�"<�"<�"A�A�A�D����)�)�+�+�q�0�0������%�%�'�'�!�+�+�(���)�����	�	�	��D�D�D�	�����#'�>�#:�#:�#:�D�D�D�A�As�B.B1�1C�?CNryrYrrrr�s7������9�9�9�B�B�B�B�Brrc��eZdZd�Zd�ZdS)rc�B�tj|tdd|���dSr|)r
r9�RECURSIVE_MUTEXr}s  rr9zRLock.__init__�s$�������1�#�>�>�>�>�>�>rc��	|j���rltj��j}tj��jdkr|dtj��jzz
}|j���}nK|j���dkrd\}}n(|j���dkrd\}}nd\}}n#t$rd\}}YnwxYwd	|j
j�d
|�d|�d�S)
Nrr�r	)r�rr)r��nonzero)r�r�)rkrkrl�(�, rn)rr�rrUr-r�r�r�rhrorprZ)r1r-�counts   rrrzRLock.__repr__�s��
	/��}�%�%�'�'�

<��.�0�0�5���+�-�-�2�l�B�B��C�)�":�"<�"<�"A�A�A�D��
�,�,�.�.�����)�)�+�+�q�0�0�'���e�e���%�%�'�'�!�+�+�:���e�e�;���e����	/�	/�	/�.�K�D�%�%�%�	/�����!%��!8�!8�!8�$�$�$����F�Fs�CC�C%�$C%NryrYrrrr�s7������?�?�?�G�G�G�G�Grrc�X�eZdZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	dd	�Z
dd�Zd�Zdd
�Z
dS)rNc��|p|���|_|�d��|_|�d��|_|�d��|_|���dS�Nr)r�_lockr�_sleeping_count�_woken_count�_wait_semaphorer+)r1�lockr5s   rr9zCondition.__init__�sj���(�S�Y�Y�[�[��
�"�}�}�Q�/�/����M�M�!�,�,���"�}�}�Q�/�/����������rc�^�tj|��|j|j|j|jfSr)r
rGr�r�r�r�r?s rrLzCondition.__getstate__�s2�����%�%�%��
�D�0��!�4�#7�9�	9rc�d�|\|_|_|_|_|���dSr)r�r�r�r�r+rOs  rrQzCondition.__setstate__�s6��49�	2���T�)�	
�	�D�0��������rc�4�|j���Sr)r�rAr?s rrAzCondition.__enter__�s���z�#�#�%�%�%rc� �|jj|�Sr)r�rCrDs  rrCzCondition.__exit__�s��"�t�z�"�D�)�)rc�J�|jj|_|jj|_dSr)r�r=r>r?s rr+zCondition._make_methods�s���z�)����z�)����rc���	|jj���|jj���z
}n#t$rd}YnwxYwd|jj�d|j�d|�d�S)Nrkrlr�r�rn)r�rrhr�rorprZr�)r1�num_waiterss  rrrzCondition.__repr__�s���	$��/�8�C�C�E�E��,�5�@�@�B�B�C�K�K���	$�	$�	$�#�K�K�K�	$�����!%��!8�!8�!8�$�*�*�*�k�k�k�R�Rs�=A�A�Ac�h�|jj���s
Jd���|j���|jj���}t
|��D]}|j����	|j�d|��|j	���t
|��D]}|j����S#|j	���t
|��D]}|j����wxYw)Nz,must acquire() condition before using wait()T)
r�rr�r�r>r�r%r�r=r�)r1�timeoutr�r7s    r�waitzCondition.wait�s>���z�"�+�+�-�-�	>�	>�=�	>�	>�-�	
��$�$�&�&�&��
�#�*�*�,�,���u���	!�	!�A��J��� � � � �		%��'�/�/��g�>�>�
��%�%�'�'�'��5�\�\�
%�
%���
�"�"�$�$�$�$�
%��
��%�%�'�'�'��5�\�\�
%�
%���
�"�"�$�$�$�$�
%���s
�C+�+AD1r	c���|jj���s
Jd���|j�d��r
Jd���|j�d��r@|j�d��}|s
Jd���|j�d���@d}||krX|j�d��r>|j���|dz
}||kr|j�d���>|rbt|��D]}|j����|j�d��r	|j�d���dSdSdS)Nzlock is not ownedFz<notify: Should not have been able to acquire _wait_semaphorez>notify: Bug in sleeping_count.acquire- res should not be Falserr	)	r�rr�r�r=r�r�r>r%)r1�n�res�sleepersr7s     r�notifyzCondition.notifys����z�"�+�+�-�-�B�B�/B�B�B�-��'�/�/����	*�	*�)�	*�	*����'�'��.�.�	8��&�.�.�u�5�5�C��
8�
8�7�
8�
8�3���'�'��.�.�	8�
����l�l�t�3�;�;�E�B�B�l�� �(�(�*�*�*���M�H���l�l�t�3�;�;�E�B�B�l��	��8�_�_�
,�
,���!�)�)�+�+�+�+��&�.�.�u�5�5�
���&�.�.�u�5�5�
�
�
�	�	�

�
rc�F�|�tj���dS)N)r�)r�r#�maxsizer?s r�
notify_allzCondition.notify_all/s�����c�k��"�"�"�"�"rc���|��}|r|S|�tj��|z}nd}d}|s@|�|tj��z
}|dkrn!|�|��|��}|�@|Sr�)�time�	monotonicr�)r1�	predicater��result�endtime�waittimes      r�wait_forzCondition.wait_for2s���������	��M����n�&�&��0�G�G��G��H��	!��"�"�T�^�%5�%5�5���q�=�=���I�I�h�����Y�[�[�F�
�	!��
rrrt)rZr[r\r9rLrQrArCr+rrr�r�r�r�rYrrrr�s�����������9�9�9�
���
&�&�&�*�*�*�*�*�*�S�S�S�%�%�%�%�.����4#�#�#������rrc�:�eZdZd�Zd�Zd�Zd�Zd	d�Zdefd�Z	dS)
rc��|�|�����|_|�d��|_dSr�)rr�_condr�_flagr}s  rr9zEvent.__init__Js4���]�]�3�8�8�:�:�.�.��
��]�]�1�%�%��
�
�
rc���|j5|j�d��r'|j���	ddd��dS	ddd��dS#1swxYwYdS�NFT)r�r�r=r>r?s r�is_setzEvent.is_setNs���
�Z�	�	��z�!�!�%�(�(�
��
�"�"�$�$�$��	�	�	�	�	�	�	�	��		�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�5A�
A�A�Ac���|j5|j�d��|j���|j���ddd��dS#1swxYwYdS�NF)r�r�r=r>r�r?s r�setz	Event.setUs���
�Z�	$�	$��J���u�%�%�%��J��� � � ��J�!�!�#�#�#�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�	$�	$s�A
A"�"A&�)A&c�z�|j5|j�d��ddd��dS#1swxYwYdSr�)r�r�r=r?s r�clearzEvent.clear[s���
�Z�	&�	&��J���u�%�%�%�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&�	&�	&s�0�4�4Nc�f�|j5|j�d��r|j���n|j�|��|j�d��r'|j���	ddd��dS	ddd��dS#1swxYwYdSr�)r�r�r=r>r�)r1r�s  rr�z
Event.wait_s
��
�Z�		�		��z�!�!�%�(�(�
)��
�"�"�$�$�$�$��
����(�(�(��z�!�!�%�(�(�
��
�"�"�$�$�$��		�		�		�		�		�		�		�		��		�		�		�		�		�		�		�		�		�		�		�		����		�		�		�		�		�		s�BB&�B&�&B*�-B*�returnc��|���rdnd}dt|��j�dt|��d�d|�d�S)Nr��unsetrlz at z#x� �>)r��typer\�id)r1�
set_statuss  rrrzEvent.__repr__ksK��"�k�k�m�m�8�U�U��
�K�4��:�:�*�K�K��4���K�K�K�j�K�K�K�Krr)
rZr[r\r9r�r�r�r��strrrrYrrrrHs�������&�&�&����$�$�$�&�&�&�
�
�
�
�L�#�L�L�L�L�L�Lrrc��eZdZd	d�Zd�Zd�Zed���Zejd���Zed���Z	e	jd���Z	dS)
�BarrierNc���ddl}ddlm}||�d��dz��}|���}|�|||||f��d|_d|_dS)Nrr	)�
BufferWrapperr7r)�struct�heapr��calcsizerrQ�_stater�)	r1�parties�actionr�r5r�r��wrapper�conds	         rr9zBarrier.__init__ts{���
�
�
�'�'�'�'�'�'��-����� 4� 4�q� 8�9�9���}�}�������7�F�G�T�7�C�D�D�D��������rc��|\|_|_|_|_|_|j����d��|_dS)Nr7)�_parties�_action�_timeoutr��_wrapper�create_memoryview�cast�_arrayrOs  rrQzBarrier.__setstate__}sF��&+�	$�����d�m�	
��T�]��m�5�5�7�7�<�<�S�A�A����rc�B�|j|j|j|j|jfSr)r�r�r�r�r�r?s rrLzBarrier.__getstate__�s"���
�t�|�T�]��
�D�M�+�	+rc��|jdSr��r�r?s rr�zBarrier._state�����{�1�~�rc��||jd<dSr�r�rqs  rr�zBarrier._state�������A���rc��|jdS�Nr	r�r?s rr�zBarrier._count�r�rc��||jd<dSr�r�rqs  rr�zBarrier._count�r�r)NN)
rZr[r\r9rQrL�propertyr��setterr�rYrrr�r�rs�����������B�B�B�
+�+�+�����X���]����]������X���]����]���rr�)�__all__r�r#r]r&r��r
rrr
r�ImportError�listr%r�rdre�objectrrrrrrr�rYrr�<module>r�s�����������
�
�
�
�������������������������������
4�4�4�4�4�4�4�4�4�4���4�4�4�
�+�3�4�4�4�4����"�T�%�%��(�(�^�^���� �(�6�
�N/�N/�N/�N/�N/�f�N/�N/�N/�h
C�
C�
C�
C�
C��
C�
C�
C�&H�H�H�H�H�y�H�H�H�"B�B�B�B�B�7�B�B�B�2G�G�G�G�G�G�G�G�G�4i�i�i�i�i��i�i�i�^%L�%L�%L�%L�%L�F�%L�%L�%L�T"�"�"�"�"�i��"�"�"�"�"s	�5�A