AlkantarClanX12

Your IP : 3.142.198.51


Current Path : /opt/alt/python310/lib64/python3.10/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/multiprocessing/__pycache__/synchronize.cpython-310.opt-2.pyc

o

6��fZ-�@sgd�ZddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	z
ddlm
Z
mZWney?ed��we
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�|dur	tj��}|��}tjdkp|dk}td�D]}zt�||||�	�|�}|_
Wn	ty5Yqwntd��t�
d|j�|��tjdkrWdd�}	t�||	�|j
jdurydd	lm}
|
|j
jd
�tj|tj|j
jfdd�dSdS)
N�win32�fork�dzcannot find name for semaphorezcreated semlock with handle %scSs|j��dS�N)�_semlock�_after_fork)�obj�r�B/opt/alt/python310/lib64/python3.10/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__2s6
��

��zSemLock.__init__cCs"ddlm}t|�||d�dS)Nr)�
unregisterr)r$r.r
)r#r.rrrr%TszSemLock._cleanupcC�|jj|_|jj|_dSr)r�acquire�release�r&rrrr"Z�
zSemLock._make_methodscC�
|j��Sr)r�	__enter__r2rrrr5^�
zSemLock.__enter__cG�|jj|�Sr)r�__exit__�r&�argsrrrr8a�zSemLock.__exit__cCsDt�|�|j}tjdkrt���|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__mszSemLock.__setstate__cCsdt��jdttj�fS)Nz%s-%sZ	semprefix)r
�current_processZ_config�nextr�_randrrrrrrs�zSemLock._make_nameN)�__name__�
__module__�__qualname__�tempfileZ_RandomNameSequencerDr-�staticmethodr%r"r5r8r>rArrrrrr.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-}�zSemaphore.__init__cCr4r)r�
_get_valuer2rrr�	get_value�r6zSemaphore.get_valuecCs6z|j��}Wntyd}Ynwd|jj|fS)N�unknownz<%s(value=%s)>)rrP�	Exception�	__class__rE�r&r(rrr�__repr__�s�zSemaphore.__repr__N�r)rErFrGr-rQrVrrrrr{s
rc@seZdZddd�Zdd�ZdS)rrcCstj|t|||d�dSrJ�rr-rLrNrrrr-�rOzBoundedSemaphore.__init__cCs<z|j��}Wntyd}Ynwd|jj||jjfS)NrRz<%s(value=%s, maxvalue=%s)>)rrPrSrTrEr)rUrrrrV�s��zBoundedSemaphore.__repr__NrW�rErFrGr-rVrrrrr�s
rc@�eZdZdd�Zdd�ZdS)rcC�tj|tdd|d�dS�NrrKrX�r&r*rrrr-�rOz
Lock.__init__cCs�z3|j��rt��j}t��jdkr|dt��j7}n|j��dkr&d}n|j��dkr0d}nd}Wnt	y>d}Ynwd	|j
j|fS)
N�
MainThread�|r�Noner�SomeOtherThread�SomeOtherProcessrRz<%s(owner=%s)>)r�_is_miner
rBr#�	threading�current_threadrP�_countrSrTrE)r&r#rrrrV�s 

���z
Lock.__repr__NrYrrrrr��rc@rZ)rcCr[r\)rr-�RECURSIVE_MUTEXr]rrrr-�rOzRLock.__init__cCs�z>|j��r!t��j}t��jdkr|dt��j7}|j��}n|j��dkr-d\}}n|j��dkr9d\}}nd\}}Wn
t	yKd\}}Ynwd	|j
j||fS)
Nr^r_r)r`rr)ra�nonzero)rbri)rRrR�<%s(%s, %s)>)rrcr
rBr#rdrerfrPrSrTrE)r&r#�countrrrrV�s 



��zRLock.__repr__NrYrrrrr�rgrc@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	r<rmrnrorpr2rrrr>�s
�zCondition.__getstate__cCs |\|_|_|_|_|��dSr)rmrnrorpr"r?rrrrA�s
�zCondition.__setstate__cCr4r)rmr5r2rrrr5�r6zCondition.__enter__cGr7r)rmr8r9rrrr8�r;zCondition.__exit__cCr/r)rmr0r1r2rrrr"�r3zCondition._make_methodscCsHz|jj��|jj��}Wntyd}Ynwd|jj|j|fS)NrRrj)rnrrProrSrTrErm)r&Znum_waitersrrrrV�s

��zCondition.__repr__c	Cs�|j��|jj��}t|�D]}|j��qz|j�d|�W|j��t|�D]}|j��q(S|j��t|�D]}|j��q:w)NT)	rnr1rmrrfrrpr0ro)r&�timeoutrkr+rrr�wait�s

�
��zCondition.waitrcCs�|j�d�r|j�d�}|j�d�sd}||kr1|j�d�r1|j��|d7}||kr1|j�d�s|rNt|�D]}|j��q7|j�d�rP	|j�d�sEdSdSdS)NFrr)ror0rnrpr1r)r&�n�resZsleepersr+rrr�notifys �
���zCondition.notifycCs|jtjd�dS)N)rt)rvr�maxsizer2rrr�
notify_all(szCondition.notify_allcCsj|�}|r|S|durt��|}nd}d}|s3|dur)|t��}|dkr)	|S|�|�|�}|r|Srl)�time�	monotonicrs)r&Z	predicaterr�resultZendtimeZwaittimerrr�wait_for+s"
��zCondition.wait_forrrW)rErFrGr-r>rAr5r8r"rVrsrvrxr|rrrrr�s


rc@s6eZdZdd�Zdd�Zdd�Zdd�Zdd
d�Zd	S)
rcCs |�|���|_|�d�|_dSrl)rr�_condr�_flagr]rrrr-CszEvent.__init__cCsV|j�|j�d�r|j��	Wd�dS	Wd�dS1s$wYdS�NFT)r}r~r0r1r2rrr�is_setGs
�$�zEvent.is_setcCsL|j�|j�d�|j��|j��Wd�dS1swYdS�NF)r}r~r0r1rxr2rrr�setNs

"�z	Event.setcCs8|j�|j�d�Wd�dS1swYdSr�)r}r~r0r2rrr�clearTs"�zEvent.clearNcCsz|j�0|j�d�r|j��n|j�|�|j�d�r*|j��	Wd�dS	Wd�dS1s6wYdSr)r}r~r0r1rs)r&rrrrrrsXs
�	$�z
Event.waitr)rErFrGr-r�r�r�rsrrrrrAs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)�structZheapr�ZcalcsizerrA�_staterf)	r&Zparties�actionrrr*r�r��wrapperZcondrrrr-js
zBarrier.__init__cCs.|\|_|_|_|_|_|j���d�|_dS)Nr+)�_parties�_action�_timeoutr}�_wrapperZcreate_memoryview�cast�_arrayr?rrrrAss�zBarrier.__setstate__cCs|j|j|j|j|jfSr)r�r�r�r}r�r2rrrr>xs�zBarrier.__getstate__cC�
|jdSrl�r�r2rrrr�|�
zBarrier._statecC�||jd<dSrlr�rUrrrr���cCr��Nrr�r2rrrrf�r�zBarrier._countcCr�r�r�rUrrrrf�r�)NN)
rErFrGr-rAr>�propertyr��setterrfrrrrr�hs
	


r�)�__all__rdrrHrry�r	r
rrr
�ImportError�listrrhrLrM�objectrrrrrrr�rrrr�<module>s0	�
Mo'