AlkantarClanX12

Your IP : 18.218.75.58


Current Path : /opt/alt/python36/lib64/python3.6/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/multiprocessing/__pycache__/synchronize.cpython-36.pyc

3

� f/�@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_openz( implementation, therefore, the requiredz+ synchronization primitives needed will notz function, see issue 3770.�c@s\eZdZej�Zdd�Zedd��Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
edd��ZdS)rc
Cs�|dkrtjj�}|j�}tjdkp*|dk}xPtd�D]<}y tj||||j	�|�}|_
Wntk
rnYq6XPq6Wtd��tj
d|j�|j�tjdkr�dd�}	tj||	�|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|jj�dS)N)�_semlock�_after_fork)�obj�r�@/opt/alt/python36/lib64/python3.6/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
|jj�S)N)r�	__enter__)r$rrrr/^szSemLock.__enter__cGs|jj|�S)N)r�__exit__)r$�argsrrrr0aszSemLock.__exit__cCsDtj|�|j}tjdkr,tj�j|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|�|_tjd|d�|j�dS)Nz recreated blocker with handle %rr)rrZ_rebuildrrrr )r$�staterrr�__setstate__mszSemLock.__setstate__cCsdtj�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
|jj�S)N)r�
_get_value)r$rrr�	get_value�szSemaphore.get_valuecCs8y|jj�}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__cCs>y|jj�}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|jj�r8tj�j}tj�jdkrd|dtj�j7}n,|jj�dkrLd}n|jj�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__cCs�y||jj�rBtj�j}tj�jdkr6|dtj�j7}|jj�}n8|jj�dkrZd\}}n |jj�dkrrd\}}nd
\}}Wnt	k
r�d\}}YnXd
|j
j||fS)NrGrHrrIrrJ�nonzerorKrCz<%s(%s, %s)>)rIr)rJrQ)rKrQ)rCrC)rrLr
r7r!rMrNrOrArDrEr:)r$r!�countrrrrF�s



zRLock.__repr__N)r:r;r<r+rFrrrrr�sc@sjeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	ddd�Z
dd�Zdd�Zddd�Z
dS)rNcCs>|p
|j�|_|jd�|_|jd�|_|jd�|_|j�dS)Nr)r�_lockr�_sleeping_count�_woken_count�_wait_semaphorer )r$�lockr(rrrr+�s
zCondition.__init__cCstj|�|j|j|j|jfS)N)r	r2rSrTrUrV)r$rrrr4�s
zCondition.__getstate__cCs |\|_|_|_|_|j�dS)N)rSrTrUrVr )r$r5rrrr6�szCondition.__setstate__cCs
|jj�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_methodscCsJy|jjj�|jjj�}Wntk
r4d}YnXd|jj|j|fS)NrCz<%s(%s, %s)>)rTrrArUrDrEr:rS)r$Znum_waitersrrrrF�s

zCondition.__repr__cCs�|jjj�std��|jj�|jjj�}xt|�D]}|jj�q4Wz|jj	d|�S|j
j�xt|�D]}|jj	�qjWXdS)Nz,must acquire() condition before using wait()T)rSrrL�AssertionErrorrTr.rOrrVr-rU)r$�timeoutrRr)rrr�wait�s

zCondition.waitcCs||jjj�std��|jjd�s&t�x$|jjd�rJ|jjd�}|s(t�q(W|jjd�rx|jj�|jj�|jjd�dS)Nzlock is not ownedF)	rSrrLrXrVr-rUrTr.)r$�resrrr�notifys

zCondition.notifycCs�|jjj�std��|jjd�s&t�x$|jjd�rJ|jjd�}|s(t�q(Wd}x"|jjd�rr|jj�|d7}qRW|r�xt	|�D]}|jj�q�Wx|jjd�r�q�WdS)Nzlock is not ownedFrr)
rSrrLrXrVr-rUrTr.r)r$r[Zsleepersr)rrr�
notify_alls
zCondition.notify_allcCsh|�}|r|S|dk	r$tj�|}nd}d}x6|sb|dk	rP|tj�}|dkrPP|j|�|�}q.W|S)Nr)�timeZ	monotonicrZ)r$Z	predicaterY�resultZendtimeZwaittimerrr�wait_for6s

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

c@s6eZdZdd�Zdd�Zdd�Zdd�Zdd
d�Zd	S)
rcCs |j|j��|_|jd�|_dS)Nr)rr�_condr�_flag)r$r(rrrr+NszEvent.__init__c	Cs0|j� |jjd�r"|jj�dSdSQRXdS)NFT)rarbr-r.)r$rrr�is_setRs

zEvent.is_setc	Cs6|j�&|jjd�|jj�|jj�WdQRXdS)NF)rarbr-r.r])r$rrr�setYs
z	Event.setc	Cs"|j�|jjd�WdQRXdS)NF)rarbr-)r$rrr�clear_szEvent.clearNc	CsT|j�D|jjd�r |jj�n|jj|�|jjd�rF|jj�dSdSQRXdS)NFT)rarbr-r.rZ)r$rYrrrrZcs
z
Event.wait)N)r:r;r<r+rcrdrerZrrrrrLs
c@sZeZdZddd�Zdd�Zdd�Zedd	��Zejd
d	��Zedd��Z	e	jd
d��Z	dS)�BarrierNc	CsRddl}ddlm}||jd�d�}|j�}|j|||||f�d|_d|_dS)Nrr)�
BufferWrapperr)r)�struct�heaprgZcalcsizerr6�_staterO)	r$Zparties�actionrYr(rhrg�wrapperZcondrrrr+uszBarrier.__init__cCs.|\|_|_|_|_|_|jj�jd�|_dS)Nr))�_parties�_action�_timeoutra�_wrapperZcreate_memoryview�cast�_array)r$r5rrrr6~szBarrier.__setstate__cCs|j|j|j|j|jfS)N)rmrnrorarp)r$rrrr4�s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�setterrOrrrrrfss
	rfzRThis platform lacks a functioning sem_open implementation, therefore, the requiredz}This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will notz�This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.)�__all__rMrr=rr^�r	r
rrr
�ImportError�listrrPr?r@�objectrrrrrrrfrrrr�<module>s0Mz'