Hacked By AnonymousFox

Current Path : /opt/alt/python39/lib64/python3.9/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/multiprocessing/__pycache__/synchronize.cpython-39.opt-1.pyc

a

R�fZ-�@s"gd�ZddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	zddlm
Z
mZWney�ed��Yn0e
ed	��\ZZej
jZGd
d�de�Z
Gdd
�d
e
�ZGdd�de�ZGdd�de
�ZGdd�de
�ZGdd�de�ZGdd�de�ZGdd�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\eZdZe��Zdd�Zedd��Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
edd��ZdS)rc	Cs�|durtj��}|��}tjdkp*|dk}td�D]<}z t�||||�	�|�}|_
WntyjYq40qzq4td��t�
d|j�|��tjdkr�dd�}	t�||	�|j
jdur�dd	lm}
|
|j
jd
�tj|tj|j
jfdd�dS)
N�win32�fork�dzcannot find name for semaphorezcreated semlock with handle %scSs|j��dS�N)�_semlock�_after_fork)�obj�r�@/opt/alt/python39/lib64/python3.9/multiprocessing/synchronize.pyrGsz%SemLock.__init__.<locals>._after_forkr)�register�	semaphorer)Zexitpriority)r	Z_default_contextZget_contextZget_start_method�sys�platform�range�_multiprocessingr�
_make_namer�FileExistsErrorr�debug�handle�
_make_methodsZregister_after_fork�name�resource_trackerrZFinalize�_cleanup)�self�kind�value�maxvalue�ctxr#Z
unlink_now�i�slrrrrr�__init__2s2
�
�zSemLock.__init__cCs"ddlm}t|�||d�dS)Nr)�
unregisterr)r$r.r
)r#r.rrrr%TszSemLock._cleanupcCs|jj|_|jj|_dSr)r�acquire�release�r&rrrr"Zs
zSemLock._make_methodscCs
|j��Sr)r�	__enter__r1rrrr2^szSemLock.__enter__cGs|jj|�Sr)r�__exit__�r&�argsrrrr3aszSemLock.__exit__cCsDt�|�|j}tjdkr,t���|j�}n|j}||j|j	|j
fS)Nr)r	�assert_spawningrrrZget_spawning_popenZduplicate_for_childr!r'r)r#)r&r,�hrrr�__getstate__ds

zSemLock.__getstate__cCs,tjj|�|_t�d|d�|��dS)Nz recreated blocker with handle %rr)rrZ_rebuildrrr r"�r&�staterrr�__setstate__mszSemLock.__setstate__cCsdt��jdttj�fS)Nz%s-%sZ	semprefix)r
�current_processZ_config�nextr�_randrrrrrrs�zSemLock._make_nameN)�__name__�
__module__�__qualname__�tempfileZ_RandomNameSequencer>r-�staticmethodr%r"r2r3r8r;rrrrrr.s"
	rc@s&eZdZd	dd�Zdd�Zdd�ZdS)
rrcCstj|t|t|d�dS�N�r*)rr-�	SEMAPHORE�
SEM_VALUE_MAX�r&r(r*rrrr-}szSemaphore.__init__cCs
|j��Sr)r�
_get_valuer1rrr�	get_value�szSemaphore.get_valuecCs6z|j��}Wnty$d}Yn0d|jj|fS)N�unknownz<%s(value=%s)>)rrI�	Exception�	__class__r?�r&r(rrr�__repr__�s

zSemaphore.__repr__N)r)r?r@rAr-rJrOrrrrr{s
rc@seZdZddd�Zdd�ZdS)rrcCstj|t|||d�dSrD�rr-rFrHrrrr-�szBoundedSemaphore.__init__cCs<z|j��}Wnty$d}Yn0d|jj||jjfS)NrKz<%s(value=%s, maxvalue=%s)>)rrIrLrMr?r)rNrrrrO�s
�zBoundedSemaphore.__repr__N)r�r?r@rAr-rOrrrrr�s
rc@seZdZdd�Zdd�ZdS)rcCstj|tdd|d�dS�NrrErP�r&r*rrrr-�sz
Lock.__init__cCs�zf|j��r8t��j}t��jdkrd|dt��j7}n,|j��dkrLd}n|j��dkr`d}nd}Wnt	y|d}Yn0d	|j
j|fS)
N�
MainThread�|r�Noner�SomeOtherThread�SomeOtherProcessrKz<%s(owner=%s)>)r�_is_miner
r<r#�	threading�current_threadrI�_countrLrMr?)r&r#rrrrO�s


z
Lock.__repr__NrQrrrrr�src@seZdZdd�Zdd�ZdS)rcCstj|tdd|d�dSrR)rr-�RECURSIVE_MUTEXrSrrrr-�szRLock.__init__cCs�z||j��rBt��j}t��jdkr6|dt��j7}|j��}n8|j��dkrZd\}}n |j��dkrrd\}}nd\}}Wnt	y�d\}}Yn0d	|j
j||fS)
NrTrUr)rVrr)rW�nonzero)rXr^)rKrK�<%s(%s, %s)>)rrYr
r<r#rZr[r\rIrLrMr?)r&r#�countrrrrO�s



zRLock.__repr__NrQrrrrr�src@sleZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	ddd�Z
ddd�Zdd�Zddd�Z
dS)rNcCs>|p
|��|_|�d�|_|�d�|_|�d�|_|��dS�Nr)r�_lockr�_sleeping_count�_woken_count�_wait_semaphorer")r&�lockr*rrrr-�s
zCondition.__init__cCst�|�|j|j|j|jfSr)r	r6rbrcrdrer1rrrr8�s
�zCondition.__getstate__cCs |\|_|_|_|_|��dSr)rbrcrdrer"r9rrrr;�s�
zCondition.__setstate__cCs
|j��Sr)rbr2r1rrrr2�szCondition.__enter__cGs|jj|�Sr)rbr3r4rrrr3�szCondition.__exit__cCs|jj|_|jj|_dSr)rbr/r0r1rrrr"�s
zCondition._make_methodscCsHz|jj��|jj��}Wnty2d}Yn0d|jj|j|fS)NrKr_)rcrrIrdrLrMr?rb)r&Znum_waitersrrrrO�s

�
zCondition.__repr__c	Cs�|j��|jj��}t|�D]}|j��qzD|j�d|�W|j��t|�D]}|j��qPS]}|j��qbn$|j��t|�D]}|j��q�0dS)NT)	rcr0rbrr\rrer/rd)r&�timeoutr`r+rrr�wait�s 

��
zCondition.waitrcCst|j�d�r|j�d�}qd}||krF|j�d�rF|j��|d7}q|rpt|�D]}|j��qR|j�d�rpqbdS)NFrr)rdr/rcrer0r)r&�n�resZsleepersr+rrr�notifys

zCondition.notifycCs|jtjd�dS)N)ri)rkr�maxsizer1rrr�
notify_all(szCondition.notify_allcCsd|�}|r|S|dur$t��|}nd}d}|s`|durN|t��}|dkrNq`|�|�|�}q,|Sra)�time�	monotonicrh)r&Z	predicaterg�resultZendtimeZwaittimerrr�wait_for+s
zCondition.wait_for)N)N)r)N)r?r@rAr-r8r;r2r3r"rOrhrkrmrqrrrrr�s


rc@s6eZdZdd�Zdd�Zdd�Zdd�Zdd
d�Zd	S)
rcCs |�|���|_|�d�|_dSra)rr�_condr�_flagrSrrrr-CszEvent.__init__cCsR|j�8|j�d�r.|j��Wd�dSWd�dS1sD0YdS�NFT)rrrsr/r0r1rrr�is_setGs

zEvent.is_setcCsJ|j�0|j�d�|j��|j��Wd�n1s<0YdS�NF)rrrsr/r0rmr1rrr�setNs
z	Event.setcCs6|j�|j�d�Wd�n1s(0YdSrv)rrrsr/r1rrr�clearTszEvent.clearNcCsv|j�\|j�d�r |j��n|j�|�|j�d�rR|j��Wd�dSWd�dS1sh0YdSrt)rrrsr/r0rh)r&rgrrrrhXs
z
Event.wait)N)r?r@rAr-rurwrxrhrrrrrAs
rc@sZeZdZddd�Zdd�Zdd�Zedd	��Zejd
d	��Zedd��Z	e	jd
d��Z	dS)�BarrierNc	CsRddl}ddlm}||�d�d�}|��}|�|||||f�d|_d|_dS)Nrr)�
BufferWrapperr+r)�struct�heaprzZcalcsizerr;�_stater\)	r&Zparties�actionrgr*r{rz�wrapperZcondrrrr-jszBarrier.__init__cCs.|\|_|_|_|_|_|j���d�|_dS)Nr+)�_parties�_action�_timeoutrr�_wrapperZcreate_memoryview�cast�_arrayr9rrrr;ss�zBarrier.__setstate__cCs|j|j|j|j|jfSr)r�r�r�rrr�r1rrrr8xs�zBarrier.__getstate__cCs
|jdSra�r�r1rrrr}|szBarrier._statecCs||jd<dSrar�rNrrrr}�scCs
|jdS�Nrr�r1rrrr\�szBarrier._countcCs||jd<dSr�r�rNrrrr\�s)NN)
r?r@rAr-r;r8�propertyr}�setterr\rrrrryhs
	


ry)�__all__rZrrBrrn�r	r
rrr
�ImportError�listrr]rFrG�objectrrrrrrryrrrr�<module>
s,	Mo'

Hacked By AnonymousFox1.0, Coded By AnonymousFox