AlkantarClanX12

Your IP : 18.118.28.217


Current Path : /opt/alt/python35/lib64/python3.5/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/multiprocessing/__pycache__/synchronize.cpython-35.opt-2.pyc



���]/�@s�ddddddgZddlZddlZddlZddlZddlmZd	d
lmZd	dlm	Z	d	dlm
Z
ydd
lmZmZWn*e
k
r�e
dddd��YnXeed��\ZZejjZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�dej�ZdS)�Lock�RLock�	Semaphore�BoundedSemaphore�	Condition�Event�N)�time�)�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
CsK|dkrtjj�}|j�}tjdkp?|dk}xbtd�D]H}y,tj||||j	�|�}|_
Wntk
r�YqOXPqOWtd��tj
d|j�|j�tjdkr�dd�}	tj||	�|j
jdk	rGdd	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�0/opt/alt/python35/lib64/python3.5/synchronize.pyrHsz%SemLock.__init__.<locals>._after_forkr	)�register�exitpriorityr)r
�_default_context�get_context�get_start_method�sys�platform�range�_multiprocessingr
�
_make_namer�FileExistsErrorr�debug�handle�
_make_methods�register_after_fork�name�semaphore_trackerr�Finalize�_cleanup)�self�kind�value�maxvalue�ctxr'Z
unlink_now�i�slrrrrr�__init__3s.

zSemLock.__init__cCs(ddlm}t|�||�dS)Nr	)�
unregister)r(r3r)r'r3rrrr*Us
zSemLock._cleanupcCs"|jj|_|jj|_dS)N)r�acquire�release)r+rrrr%[szSemLock._make_methodscCs
|jj�S)N)r�	__enter__)r+rrrr6_szSemLock.__enter__cGs|jj|�S)N)r�__exit__)r+�argsrrrr7bszSemLock.__exit__cCsbtj|�|j}tjdkr@tj�j|j�}n	|j}||j|j	|j
fS)Nr)r
�assert_spawningrrr�get_spawning_popen�duplicate_for_childr$r,r.r')r+r1�hrrr�__getstate__es
		zSemLock.__getstate__cCs8tjj|�|_tjd|d�|j�dS)Nz recreated blocker with handle %rr)r r
�_rebuildrrr#r%)r+�staterrr�__setstate__nszSemLock.__setstate__cCs$dtj�jdttj�fS)Nz%s-%s�	semprefix)r�current_process�_config�nextr
�_randrrrrr!sszSemLock._make_nameN)�__name__�
__module__�__qualname__�tempfile�_RandomNameSequencerEr2�staticmethodr*r%r6r7r=r@r!rrrrr
/s"	r
c@s7eZdZddd�Zdd�Zdd�ZdS)	rr	cCs tj|t|td|�dS)Nr/)r
r2�	SEMAPHORE�
SEM_VALUE_MAX)r+r-r/rrrr2~szSemaphore.__init__cCs
|jj�S)N)r�
_get_value)r+rrr�	get_value�szSemaphore.get_valuecCsBy|jj�}Wntk
r-d}YnXd|jj|fS)N�unknownz<%s(value=%s)>)rrN�	Exception�	__class__rF)r+r-rrr�__repr__�s

zSemaphore.__repr__N)rFrGrHr2rOrSrrrrr|sc@s+eZdZddd�Zdd�ZdS)rr	cCs tj|t||d|�dS)Nr/)r
r2rL)r+r-r/rrrr2�szBoundedSemaphore.__init__cCsKy|jj�}Wntk
r-d}YnXd|jj||jjfS)NrPz<%s(value=%s, maxvalue=%s)>)rrNrQrRrFr.)r+r-rrrrS�s
zBoundedSemaphore.__repr__N)rFrGrHr2rSrrrrr�sc@s(eZdZdd�Zdd�ZdS)rcCs tj|tddd|�dS)Nr	r/)r
r2rL)r+r/rrrr2�sz
Lock.__init__cCs�y�|jj�rPtj�j}tj�jdkr�|dtj�j7}nB|jj�dkrnd}n$|jj�dkr�d}nd}Wnt	k
r�d}YnXd	|j
j|fS)
N�
MainThread�|r	�Noner�SomeOtherThread�SomeOtherProcessrPz<%s(owner=%s)>)r�_is_minerrBr'�	threading�current_threadrN�_countrQrRrF)r+r'rrrrS�s		

z
Lock.__repr__N)rFrGrHr2rSrrrrr�sc@s(eZdZdd�Zdd�ZdS)rcCs tj|tddd|�dS)Nr	r/)r
r2�RECURSIVE_MUTEX)r+r/rrrr2�szRLock.__init__cCs�y�|jj�r_tj�j}tj�jdkrM|dtj�j7}|jj�}nT|jj�dkr�d\}}n0|jj�dkr�d\}}nd
\}}Wnt	k
r�d\}}YnXd
|j
j||fS)NrTrUr	rVrrW�nonzerorXrPz<%s(%s, %s)>)rVr)rWr^)rXr^)rPrP)rrYrrBr'rZr[r\rNrQrRrF)r+r'�countrrrrS�s
zRLock.__repr__N)rFrGrHr2rSrrrrr�sc@s�eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	ddd�Z
dd�Zdd�Zddd�Z
dS)rNcCsY|p|j�|_|jd�|_|jd�|_|jd�|_|j�dS)Nr)r�_lockr�_sleeping_count�_woken_count�_wait_semaphorer%)r+�lockr/rrrr2�s
zCondition.__init__cCs)tj|�|j|j|j|jfS)N)r
r9r`rarbrc)r+rrrr=�s
zCondition.__getstate__cCs,|\|_|_|_|_|j�dS)N)r`rarbrcr%)r+r?rrrr@�szCondition.__setstate__cCs
|jj�S)N)r`r6)r+rrrr6�szCondition.__enter__cGs|jj|�S)N)r`r7)r+r8rrrr7�szCondition.__exit__cCs"|jj|_|jj|_dS)N)r`r4r5)r+rrrr%�szCondition._make_methodscCs[y&|jjj�|jjj�}Wntk
r@d}YnXd|jj|j|fS)NrPz<%s(%s, %s)>)rarrNrbrQrRrFr`)r+Znum_waitersrrrrS�s
zCondition.__repr__cCs�|jj�|jjj�}x!t|�D]}|jj�q,Wz|jjd|�SWd|jj�x!t|�D]}|jj�qwWXdS)NT)	rar5r`rr\rrcr4rb)r+�timeoutr_r0rrr�wait�s

zCondition.waitcCskx(|jjd�r*|jjd�}qW|jjd�rg|jj�|jj�|jjd�dS)NF)rbr4rarcr5)r+�resrrr�notifys

zCondition.notifycCs�x(|jjd�r*|jjd�}qWd}x-|jjd�r`|jj�|d7}q4W|r�x!t|�D]}|jj�qtWx|jjd�r�q�WdS)NFrr	)rbr4rarcr5r)r+rgZsleepersr0rrr�
notify_all s
zCondition.notify_allcCs�|�}|r|S|dk	r/t�|}nd}d}xF|s�|dk	rj|t�}|dkrjP|j|�|�}q>W|S)Nr)�_timerf)r+�	predicatere�result�endtime�waittimerrr�wait_for7s		


zCondition.wait_for)rFrGrHr2r=r@r6r7r%rSrfrhrirorrrrr�sc@sOeZdZdd�Zdd�Zdd�Zdd�Zd	d
d�Zd	S)rcCs.|j|j��|_|jd�|_dS)Nr)rr�_condr�_flag)r+r/rrrr2OszEvent.__init__c	Cs<|j�,|jjd�r-|jj�dSdSWdQRXdS)NFT)rprqr4r5)r+rrr�is_setSs


zEvent.is_setc	Cs?|j�/|jjd�|jj�|jj�WdQRXdS)NF)rprqr4r5ri)r+rrr�setZs

z	Event.setc	Cs%|j�|jjd�WdQRXdS)NF)rprqr4)r+rrr�clear`s
zEvent.clearNc	Csn|j�^|jjd�r,|jj�n|jj|�|jjd�r_|jj�dSdSWdQRXdS)NFT)rprqr4r5rf)r+rerrrrfds

z
Event.wait)rFrGrHr2rrrsrtrfrrrrrMs
c@s�eZdZdddd�Zdd�Zdd�Zedd	��Zejd
d	��Zedd��Z	e	jd
d��Z	dS)�BarrierNc	Cssddl}ddlm}||jd�d�}|j�}|j|||||f�d|_d|_dS)Nrr	)�
BufferWrapperr0r)�struct�heaprv�calcsizerr@�_stater\)	r+�parties�actionrer/rwrv�wrapperZcondrrrr2vs	zBarrier.__init__cCsC|\|_|_|_|_|_|jj�jd�|_dS)Nr0)�_parties�_action�_timeoutrp�_wrapperZcreate_memoryview�cast�_array)r+r?rrrr@s$zBarrier.__setstate__cCs"|j|j|j|j|jfS)N)r~rr�rpr�)r+rrrr=�szBarrier.__getstate__cCs|jdS)Nr)r�)r+rrrrz�szBarrier._statecCs||jd<dS)Nr)r�)r+r-rrrrz�scCs|jdS)Nr	)r�)r+rrrr\�szBarrier._countcCs||jd<dS)Nr	)r�)r+r-rrrr\�s)
rFrGrHr2r@r=�propertyrz�setterr\rrrrruts	ru)�__all__rZrrIr rrj�r
rrr
r�ImportError�listrr]rLrM�objectrrrrrrrurrrr�<module>s0
Mz'