ok

Mini Shell

Direktori : /lib64/python3.6/multiprocessing/__pycache__/
Upload File :
Current File : //lib64/python3.6/multiprocessing/__pycache__/synchronize.cpython-36.opt-1.pyc

3


 \/�@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�3/usr/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__cCsn|jj�|jjj�}xt|�D]}|jj�q Wz|jjd|�S|jj�xt|�D]}|jj�qVWXdS)NT)	rTr.rSrrOrrVr-rU)r$�timeoutrRr)rrr�wait�s

zCondition.waitcCsNx|jjd�r|jjd�}qW|jjd�rJ|jj�|jj�|jjd�dS)NF)rUr-rTrVr.)r$�resrrr�notifys

zCondition.notifycCs|x|jjd�r|jjd�}qWd}x"|jjd�rD|jj�|d7}q$W|rxxt|�D]}|jj�qTWx|jjd�rvqhWdS)NFrr)rUr-rTrVr.r)r$rZZsleepersr)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	monotonicrY)r$Z	predicaterX�resultZendtimeZwaittimerrr�wait_for6s

zCondition.wait_for)N)N)N)r:r;r<r+r4r6r/r0r rFrYr[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)r`rar-r.)r$rrr�is_setRs

zEvent.is_setc	Cs6|j�&|jjd�|jj�|jj�WdQRXdS)NF)r`rar-r.r\)r$rrr�setYs
z	Event.setc	Cs"|j�|jjd�WdQRXdS)NF)r`rar-)r$rrr�clear_szEvent.clearNc	CsT|j�D|jjd�r |jj�n|jj|�|jjd�rF|jj�dSdSQRXdS)NFT)r`rar-r.rY)r$rXrrrrYcs
z
Event.wait)N)r:r;r<r+rbrcrdrYrrrrrLs
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�heaprfZcalcsizerr6�_staterO)	r$Zparties�actionrXr(rgrf�wrapperZcondrrrr+uszBarrier.__init__cCs.|\|_|_|_|_|_|jj�jd�|_dS)Nr))�_parties�_action�_timeoutr`�_wrapperZcreate_memoryview�cast�_array)r$r5rrrr6~szBarrier.__setstate__cCs|j|j|j|j|jfS)N)rlrmrnr`ro)r$rrrr4�szBarrier.__getstate__cCs
|jdS)Nr)rq)r$rrrri�szBarrier._statecCs||jd<dS)Nr)rq)r$r&rrrri�scCs
|jdS)Nr)rq)r$rrrrO�szBarrier._countcCs||jd<dS)Nr)rq)r$r&rrrrO�s)NN)
r:r;r<r+r6r4�propertyri�setterrOrrrrress
	rezRThis 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@�objectrrrrrrrerrrr�<module>s0Mz'

Zerion Mini Shell 1.0