AlkantarClanX12

Your IP : 3.139.98.10


Current Path : /opt/alt/python37/lib64/python3.7/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/multiprocessing/__pycache__/synchronize.cpython-37.opt-1.pyc

B

� fA-�@s,ddddddgZddlZddlZddlZddlZddlZdd	lmZdd
lmZddlm	Z	yddlm
Z
mZWnek
r�ed
��YnXe
ed��\ZZej
jZGdd�de�Z
Gdd�de
�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�|dkrtj��}|��}tjdkp*|dk}xPtd�D]<}y t�||||�	�|�}|_
Wntk
rnYq6XPq6Wtd��t�
d|j�|��tjdkr�dd�}	t�||	�|j
jdk	r�dd	lm}
|
|j
j�tj|tj|j
jfd
d�dS)N�win32�fork�dzcannot find name for semaphorezcreated semlock with handle %scSs|j��dS)N)�_semlock�_after_fork)�obj�r�@/opt/alt/python37/lib64/python3.7/multiprocessing/synchronize.pyrGsz%SemLock.__init__.<locals>._after_forkr)�registerr)Zexitpriority)r	Z_default_contextZget_contextZget_start_method�sys�platform�range�_multiprocessingr�
_make_namer�FileExistsErrorr�debug�handle�
_make_methodsZregister_after_fork�name�semaphore_trackerrZFinalize�_cleanup)�self�kind�value�maxvalue�ctxr!Z
unlink_now�i�slrrrrr�__init__2s.

zSemLock.__init__cCs ddlm}t|�||�dS)Nr)�
unregister)r"r,r
)r!r,rrrr#TszSemLock._cleanupcCs|jj|_|jj|_dS)N)r�acquire�release)r$rrrr Zs
zSemLock._make_methodscCs
|j��S)N)r�	__enter__)r$rrrr/^szSemLock.__enter__cGs|jj|�S)N)r�__exit__)r$�argsrrrr0aszSemLock.__exit__cCsDt�|�|j}tjdkr,t���|j�}n|j}||j|j	|j
fS)Nr)r	�assert_spawningrrrZget_spawning_popenZduplicate_for_childrr%r'r!)r$r*�hrrr�__getstate__ds

zSemLock.__getstate__cCs,tjj|�|_t�d|d�|��dS)Nz recreated blocker with handle %rr)rrZ_rebuildrrrr )r$�staterrr�__setstate__mszSemLock.__setstate__cCsdt��jdttj�fS)Nz%s-%sZ	semprefix)r
�current_processZ_config�nextr�_randrrrrrrszSemLock._make_nameN)�__name__�
__module__�__qualname__�tempfileZ_RandomNameSequencer9r+�staticmethodr#r r/r0r4r6rrrrrr.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��S)N)r�
_get_value)r$rrr�	get_value�szSemaphore.get_valuecCs8y|j��}Wntk
r&d}YnXd|jj|fS)N�unknownz<%s(value=%s)>)rrA�	Exception�	__class__r:)r$r&rrr�__repr__�s

zSemaphore.__repr__N)r)r:r;r<r+rBrFrrrrr{s
c@seZdZddd�Zdd�ZdS)rrcCstj|t|||d�dS)N)r()rr+r?)r$r&r(rrrr+�szBoundedSemaphore.__init__cCs>y|j��}Wntk
r&d}YnXd|jj||jjfS)NrCz<%s(value=%s, maxvalue=%s)>)rrArDrEr:r')r$r&rrrrF�s
zBoundedSemaphore.__repr__N)r)r:r;r<r+rFrrrrr�s
c@seZdZdd�Zdd�ZdS)rcCstj|tdd|d�dS)Nr)r()rr+r?)r$r(rrrr+�sz
Lock.__init__cCs�yf|j��r8t��j}t��jdkrd|dt��j7}n,|j��dkrLd}n|j��dkr`d}nd}Wnt	k
r~d}YnXd	|j
j|fS)
N�
MainThread�|r�Noner�SomeOtherThread�SomeOtherProcessrCz<%s(owner=%s)>)r�_is_miner
r7r!�	threading�current_threadrA�_countrDrEr:)r$r!rrrrF�s


z
Lock.__repr__N)r:r;r<r+rFrrrrr�sc@seZdZdd�Zdd�ZdS)rcCstj|tdd|d�dS)Nr)r()rr+�RECURSIVE_MUTEX)r$r(rrrr+�szRLock.__init__cCs�y||j��rBt��j}t��jdkr6|dt��j7}|j��}n8|j��dkrZd\}}n |j��dkrrd\}}nd\}}Wnt	k
r�d\}}YnXd	|j
j||fS)
NrGrHr)rIrr)rJ�nonzero)rKrQ)rCrCz<%s(%s, %s)>)rrLr
r7r!rMrNrOrArDrEr:)r$r!�countrrrrF�s



zRLock.__repr__N)r:r;r<r+rFrrrrr�sc@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|jfS)N)r	r2rSrTrUrV)r$rrrr4�s
zCondition.__getstate__cCs |\|_|_|_|_|��dS)N)rSrTrUrVr )r$r5rrrr6�szCondition.__setstate__cCs
|j��S)N)rSr/)r$rrrr/�szCondition.__enter__cGs|jj|�S)N)rSr0)r$r1rrrr0�szCondition.__exit__cCs|jj|_|jj|_dS)N)rSr-r.)r$rrrr �s
zCondition._make_methodscCsJy|jj��|jj��}Wntk
r4d}YnXd|jj|j|fS)NrCz<%s(%s, %s)>)rTrrArUrDrEr:rS)r$Znum_waitersrrrrF�s

zCondition.__repr__c	Csn|j��|jj��}xt|�D]}|j��q Wz|j�d|�S|j��xt|�D]}|j��qVWXdS)NT)	rTr.rSrrOrrVr-rU)r$�timeoutrRr)rrr�wait�s

zCondition.waitrcCs�x|j�d�r|j�d�}qWd}x*||krL|j�d�rL|j��|d7}q$W|r�xt|�D]}|j��q\Wx|j�d�r~qpWdS)NFrr)rUr-rTrVr.r)r$�nZresZsleepersr)rrr�notifys
zCondition.notifycCs|jtjd�dS)N)rZ)r[r�maxsize)r$rrr�
notify_all(szCondition.notify_allcCsh|�}|r|S|dk	r$t��|}nd}d}x6|sb|dk	rP|t��}|dkrPP|�|�|�}q.W|S)Nr)�timeZ	monotonicrY)r$Z	predicaterX�resultZendtimeZwaittimerrr�wait_for+s

zCondition.wait_for)N)N)r)N)r:r;r<r+r4r6r/r0r rFrYr[r]r`rrrrr�s


c@s6eZdZdd�Zdd�Zdd�Zdd�Zdd
d�Zd	S)
rcCs |�|���|_|�d�|_dS)Nr)rr�_condr�_flag)r$r(rrrr+CszEvent.__init__c	Cs0|j� |j�d�r"|j��dSdSQRXdS)NFT)rarbr-r.)r$rrr�is_setGs

zEvent.is_setc	Cs6|j�&|j�d�|j��|j��WdQRXdS)NF)rarbr-r.r])r$rrr�setNs
z	Event.setc	Cs"|j�|j�d�WdQRXdS)NF)rarbr-)r$rrr�clearTszEvent.clearNc	CsT|j�D|j�d�r |j��n|j�|�|j�d�rF|j��dSdSQRXdS)NFT)rarbr-r.rY)r$rXrrrrYXs
z
Event.wait)N)r:r;r<r+rcrdrerYrrrrrAs
c@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�heaprgZcalcsizerr6�_staterO)	r$Zparties�actionrXr(rhrg�wrapperZcondrrrr+jszBarrier.__init__cCs.|\|_|_|_|_|_|j���d�|_dS)Nr))�_parties�_action�_timeoutra�_wrapperZcreate_memoryview�cast�_array)r$r5rrrr6sszBarrier.__setstate__cCs|j|j|j|j|jfS)N)rmrnrorarp)r$rrrr4xszBarrier.__getstate__cCs
|jdS)Nr)rr)r$rrrrj|szBarrier._statecCs||jd<dS)Nr)rr)r$r&rrrrj�scCs
|jdS)Nr)rr)r$rrrrO�szBarrier._countcCs||jd<dS)Nr)rr)r$r&rrrrO�s)NN)
r:r;r<r+r6r4�propertyrj�setterrOrrrrrfhs
	rf)�__all__rMrr=rr^�r	r
rrr
�ImportError�listrrPr?r@�objectrrrrrrrfrrrr�<module>s.Mo'