OwlCyberSecurity - MANAGER
Edit File: synchronize.cpython-39.opt-2.pyc
a ����?�gZ-����������������������@���s"��g�d��Z�ddlZddlZddlZddlZddlZddlmZ�ddlmZ�ddlm Z �zddlm Z mZ�W�n�ey����ed��Y�n0�e ed ��\ZZej jZG�d d��de�Z G�dd ��d e �ZG�dd��de�ZG�dd��de �ZG�dd��de �ZG�dd��de�ZG�dd��de�ZG�dd��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�������������������@���s\���e�Zd�Ze���Zdd��Zedd���Zdd��Z dd��Z d d ��Zdd��Zd d��Z edd���ZdS�)r���c������������� ���C���s����|d�u�rt�j���}|���}tjdkp*|dk}td�D�]<}z t�||||�� ��|��}|�_ W�n�tyj���Y�q40��qzq4td��t� d|j���|�����tjdkr�dd��} t�|�| ��|�j jd�ur�dd lm} �| |�j jd ��tj|�tj|�j jfdd��d�S�) N�win32�fork�d���zcannot find name for semaphorezcreated semlock with handle %sc�����������������S���s���|�j�����d�S��N)�_semlock�_after_fork)�obj��r����@/opt/alt/python39/lib64/python3.9/multiprocessing/synchronize.pyr���G���s����z%SemLock.__init__.<locals>._after_forkr���)�register� semaphorer���)Zexitpriority)r ���Z_default_contextZget_contextZget_start_method�sys�platform�range�_multiprocessingr���� _make_namer����FileExistsErrorr����debug�handle� _make_methodsZregister_after_fork�name�resource_trackerr���ZFinalize�_cleanup)�self�kind�value�maxvalue�ctxr#���Z unlink_now�i�slr���r���r���r���r����__init__2���s2���� � �zSemLock.__init__c�����������������C���s"���ddl�m}�t|���||�d��d�S�)Nr���)� unregisterr���)r$���r.���r ���)r#���r.���r���r���r���r%���T���s����zSemLock._cleanupc�����������������C���s���|�j�j|�_|�j�j|�_d�S�r���)r����acquire�release�r&���r���r���r���r"���Z���s���� zSemLock._make_methodsc�����������������C���s ���|�j����S�r���)r���� __enter__r1���r���r���r���r2���^���s����zSemLock.__enter__c�����������������G���s���|�j�j|��S�r���)r����__exit__�r&����argsr���r���r���r3���a���s����zSemLock.__exit__c�����������������C���sD���t��|���|�j}tjdkr,t�����|j�}n|j}||j|j |j fS�)Nr���)r ����assert_spawningr���r���r���Zget_spawning_popenZduplicate_for_childr!���r'���r)���r#���)r&���r,����hr���r���r����__getstate__d���s���� zSemLock.__getstate__c�����������������C���s,���t�jj|��|�_t�d|d����|�����d�S�)Nz recreated blocker with handle %rr���)r���r���Z_rebuildr���r���r ���r"����r&����stater���r���r����__setstate__m���s����zSemLock.__setstate__c�������������������C���s���dt����jd�ttj�f�S�)Nz%s-%sZ semprefix)r ����current_processZ_config�nextr����_randr���r���r���r���r���r���s�����zSemLock._make_nameN)�__name__� __module__�__qualname__�tempfileZ_RandomNameSequencer>���r-����staticmethodr%���r"���r2���r3���r8���r;���r���r���r���r���r���r���.���s���" r���c�������������������@���s&���e�Zd�Zd dd�Zdd��Zdd��ZdS�) r���r���c����������������C���s���t�j|�t|t|d��d�S��N�r*���)r���r-���� SEMAPHORE� SEM_VALUE_MAX�r&���r(���r*���r���r���r���r-���}���s����zSemaphore.__init__c�����������������C���s ���|�j����S�r���)r���� _get_valuer1���r���r���r���� get_value����s����zSemaphore.get_valuec�����������������C���s6���z|�j����}W�n�ty$���d}Y�n0�d|�jj|f�S�)N�unknownz<%s(value=%s)>)r���rI���� Exception� __class__r?����r&���r(���r���r���r����__repr__����s ���� zSemaphore.__repr__N)r���)r?���r@���rA���r-���rJ���rO���r���r���r���r���r���{���s��� r���c�������������������@���s���e�Zd�Zddd�Zdd��ZdS�)r���r���c����������������C���s���t�j|�t|||d��d�S�rD����r���r-���rF���rH���r���r���r���r-�������s����zBoundedSemaphore.__init__c�����������������C���s<���z|�j����}W�n�ty$���d}Y�n0�d|�jj||�j�jf�S�)NrK���z<%s(value=%s, maxvalue=%s)>)r���rI���rL���rM���r?���r)���rN���r���r���r���rO�������s���� �zBoundedSemaphore.__repr__N)r����r?���r@���rA���r-���rO���r���r���r���r���r�������s��� r���c�������������������@���s���e�Zd�Zdd��Zdd��ZdS�)r���c����������������C���s���t�j|�tdd|d��d�S��Nr���rE���rP����r&���r*���r���r���r���r-�������s����z Lock.__init__c�����������������C���s����zf|�j����r8t���j}t���jdkrd|dt���j�7�}n,|�j����dkrLd}n|�j����dkr`d}nd}W�n�t y|���d}Y�n0�d |�j j|f�S�) N� MainThread�|r����Noner����SomeOtherThread�SomeOtherProcessrK���z<%s(owner=%s)>)r����_is_miner ���r<���r#���� threading�current_threadrI����_countrL���rM���r?���)r&���r#���r���r���r���rO�������s���� z Lock.__repr__NrQ���r���r���r���r���r�������s���r���c�������������������@���s���e�Zd�Zdd��Zdd��ZdS�)r���c����������������C���s���t�j|�tdd|d��d�S�rR���)r���r-����RECURSIVE_MUTEXrS���r���r���r���r-�������s����zRLock.__init__c�����������������C���s����z||�j����rBt���j}t���jdkr6|dt���j�7�}|�j����}n8|�j����dkrZd\}}n |�j����dkrrd\}}nd\}}W�n�t y����d\}}Y�n0�d |�j j||f�S�) NrT���rU���r���)rV���r���r���)rW����nonzero)rX���r^���)rK���rK����<%s(%s, %s)>)r���rY���r ���r<���r#���rZ���r[���r\���rI���rL���rM���r?���)r&���r#����countr���r���r���rO�������s���� zRLock.__repr__NrQ���r���r���r���r���r�������s���r���c�������������������@���sl���e�Zd�Zddd�Zdd��Zdd��Zdd ��Zd d��Zdd ��Zdd��Z ddd�Z ddd�Zdd��Zddd�Z dS�)r���Nc����������������C���s>���|p |����|�_|�d�|�_|�d�|�_|�d�|�_|�����d�S��Nr���)r����_lockr����_sleeping_count�_woken_count�_wait_semaphorer"���)r&����lockr*���r���r���r���r-�������s ����zCondition.__init__c�����������������C���s���t��|���|�j|�j|�j|�jfS�r���)r ���r6���rb���rc���rd���re���r1���r���r���r���r8�������s���� �zCondition.__getstate__c�����������������C���s ���|\|�_�|�_|�_|�_|�����d�S�r���)rb���rc���rd���re���r"���r9���r���r���r���r;�������s����� zCondition.__setstate__c�����������������C���s ���|�j����S�r���)rb���r2���r1���r���r���r���r2�������s����zCondition.__enter__c�����������������G���s���|�j�j|��S�r���)rb���r3���r4���r���r���r���r3�������s����zCondition.__exit__c�����������������C���s���|�j�j|�_|�j�j|�_d�S�r���)rb���r/���r0���r1���r���r���r���r"�������s���� zCondition._make_methodsc�����������������C���sH���z|�j�j���|�jj����}W�n�ty2���d}Y�n0�d|�jj|�j|f�S�)NrK���r_���)rc���r���rI���rd���rL���rM���r?���rb���)r&���Znum_waitersr���r���r���rO�������s���� � zCondition.__repr__c�������������� ���C���s����|�j�����|�jj���}t|�D�]}|�j����qzD|�j�d|�W�|�j����t|�D�]}|�j����qPS�]}|�j����qbn$|�j����t|�D�]}|�j����q�0�d�S�)NT) rc���r0���rb���r���r\���r���re���r/���rd���)r&����timeoutr`���r+���r���r���r����wait����s ���� ��� zCondition.waitr���c�����������������C���st���|�j��d�r|�j�d�}q�d}||k�rF|�j�d�rF|�j����|d7�}q|rpt|�D�]}|�j�����qR|�j�d�rpqbd�S�)NFr���r���)rd���r/���rc���re���r0���r���)r&����n�resZsleepersr+���r���r���r����notify��s���� zCondition.notifyc�����������������C���s���|�j�tjd��d�S�)N)ri���)rk���r����maxsizer1���r���r���r���� notify_all(��s����zCondition.notify_allc�����������������C���sd���|��}|r|S�|d�ur$t����|�}nd�}d�}|s`|d�urN|t�����}|dkrNq`|��|��|��}q,|S�ra���)�time� monotonicrh���)r&���Z predicaterg����resultZendtimeZwaittimer���r���r����wait_for+��s���� zCondition.wait_for)N)N)r���)N)r?���r@���rA���r-���r8���r;���r2���r3���r"���rO���rh���rk���rm���rq���r���r���r���r���r�������s��� r���c�������������������@���s6���e�Zd�Zdd��Zdd��Zdd��Zdd��Zdd d�Zd S�) r���c����������������C���s ���|��|����|�_|�d�|�_d�S�ra���)r���r����_condr����_flagrS���r���r���r���r-���C��s����zEvent.__init__c�����������������C���sR���|�j��8�|�j�d�r.|�j����W�d�����dS�W�d�����dS�1�sD0����Y��d�S��NFT)rr���rs���r/���r0���r1���r���r���r����is_setG��s ���� zEvent.is_setc�����������������C���sJ���|�j��0�|�j�d��|�j����|�j�����W�d�����n1�s<0����Y��d�S��NF)rr���rs���r/���r0���rm���r1���r���r���r����setN��s���� z Event.setc�����������������C���s6���|�j���|�j�d��W�d�����n1�s(0����Y��d�S�rv���)rr���rs���r/���r1���r���r���r����clearT��s����zEvent.clearNc�����������������C���sv���|�j��\�|�j�d�r |�j����n|�j��|��|�j�d�rR|�j����W�d�����dS�W�d�����dS�1�sh0����Y��d�S�rt���)rr���rs���r/���r0���rh���)r&���rg���r���r���r���rh���X��s���� z Event.wait)N)r?���r@���rA���r-���ru���rw���rx���rh���r���r���r���r���r���A��s ���r���c�������������������@���sZ���e�Zd�Zddd�Zdd��Zdd��Zedd ���Zejd d ���Zedd���Z e jd d���Z dS�)�BarrierNc���������� ������C���sR���dd�l�}ddlm}�||�d�d��}|���}|��|||||f��d|�_d|�_d�S�)Nr���r���)� BufferWrapperr+���r���)�struct�heaprz���Zcalcsizer���r;����_stater\���) r&���Zparties�actionrg���r*���r{���rz����wrapperZcondr���r���r���r-���j��s����zBarrier.__init__c�����������������C���s.���|\|�_�|�_|�_|�_|�_|�j����d�|�_d�S�)Nr+���)�_parties�_action�_timeoutrr����_wrapperZcreate_memoryview�cast�_arrayr9���r���r���r���r;���s��s�����zBarrier.__setstate__c�����������������C���s���|�j�|�j|�j|�j|�jfS�r���)r����r����r����rr���r����r1���r���r���r���r8���x��s�����zBarrier.__getstate__c�����������������C���s ���|�j�d�S�ra����r����r1���r���r���r���r}���|��s����zBarrier._statec�����������������C���s���||�j�d<�d�S�ra���r����rN���r���r���r���r}������s����c�����������������C���s ���|�j�d�S��Nr���r����r1���r���r���r���r\������s����zBarrier._countc�����������������C���s���||�j�d<�d�S�r����r����rN���r���r���r���r\������s����)NN) r?���r@���rA���r-���r;���r8����propertyr}����setterr\���r���r���r���r���ry���h��s��� ry���)�__all__rZ���r���rB���r���rn�����r ���r ���r���r���r ����ImportError�listr���r]���rF���rG����objectr���r���r���r���r���r���ry���r���r���r���r����<module> ���s,��� Mo'