Mini Shell

Direktori : /usr/lib64/python3.9/multiprocessing/__pycache__/
Upload File :
Current File : //usr/lib64/python3.9/multiprocessing/__pycache__/synchronize.cpython-39.pyc

a

�DOgZ-�@s"gd�ZddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	zddlm
Z
mZWney�ed��Yn0e
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�|durtj��}|��}tjdkp*|dk}td�D]<}z t�||||�	�|�}|_
WntyjYq40qzq4td��t�
d|j�|��tjdkr�dd�}	t�||	�|j
jdur�dd	lm}
|
|j
jd
�tj|tj|j
jfdd�dS)
N�win32�fork�dzcannot find name for semaphorezcreated semlock with handle %scSs|j��dS�N)�_semlock�_after_fork)�obj�r�3/usr/lib64/python3.9/multiprocessing/synchronize.pyrGsz%SemLock.__init__.<locals>._after_forkr)�register�	semaphorer)�exitpriority)r	�_default_context�get_context�get_start_method�sys�platform�range�_multiprocessingr�
_make_namer�FileExistsErrorr�debug�handle�
_make_methods�register_after_fork�name�resource_trackerr�Finalize�_cleanup)�self�kind�value�maxvalue�ctxr(�
unlink_now�i�slrrrrr�__init__2s2
�
�zSemLock.__init__cCs"ddlm}t|�||d�dS)Nr)�
unregisterr)r)r5r
)r(r5rrrr+TszSemLock._cleanupcCs|jj|_|jj|_dSr)r�acquire�release�r,rrrr&Zs
zSemLock._make_methodscCs
|j��Sr)r�	__enter__r8rrrr9^szSemLock.__enter__cGs|jj|�Sr)r�__exit__�r,�argsrrrr:aszSemLock.__exit__cCsDt�|�|j}tjdkr,t���|j�}n|j}||j|j	|j
fS)Nr)r	�assert_spawningrrr�get_spawning_popen�duplicate_for_childr%r-r/r()r,r3�hrrr�__getstate__ds

zSemLock.__getstate__cCs,tjj|�|_t�d|d�|��dS)Nz recreated blocker with handle %rr)r!r�_rebuildrrr$r&�r,�staterrr�__setstate__mszSemLock.__setstate__cCsdt��jdttj�fS)Nz%s-%s�	semprefix)r
�current_process�_config�nextr�_randrrrrr"rs�zSemLock._make_nameN)�__name__�
__module__�__qualname__�tempfile�_RandomNameSequencerJr4�staticmethodr+r&r9r:rArEr"rrrrr.s"
	rc@s&eZdZd	dd�Zdd�Zdd�ZdS)
rrcCstj|t|t|d�dS�N�r0)rr4�	SEMAPHORE�
SEM_VALUE_MAX�r,r.r0rrrr4}szSemaphore.__init__cCs
|j��Sr)r�
_get_valuer8rrr�	get_value�szSemaphore.get_valuecCs6z|j��}Wnty$d}Yn0d|jj|fS)N�unknownz<%s(value=%s)>)rrV�	Exception�	__class__rK�r,r.rrr�__repr__�s

zSemaphore.__repr__N)r)rKrLrMr4rWr\rrrrr{s
rc@seZdZddd�Zdd�ZdS)rrcCstj|t|||d�dSrQ�rr4rSrUrrrr4�szBoundedSemaphore.__init__cCs<z|j��}Wnty$d}Yn0d|jj||jjfS)NrXz<%s(value=%s, maxvalue=%s)>)rrVrYrZrKr/r[rrrr\�s
�zBoundedSemaphore.__repr__N)r�rKrLrMr4r\rrrrr�s
rc@seZdZdd�Zdd�ZdS)rcCstj|tdd|d�dS�NrrRr]�r,r0rrrr4�sz
Lock.__init__cCs�zf|j��r8t��j}t��jdkrd|dt��j7}n,|j��dkrLd}n|j��dkr`d}nd}Wnt	y|d}Yn0d	|j
j|fS)
N�
MainThread�|r�Noner�SomeOtherThread�SomeOtherProcessrXz<%s(owner=%s)>)r�_is_miner
rGr(�	threading�current_threadrV�_countrYrZrK)r,r(rrrr\�s


z
Lock.__repr__Nr^rrrrr�src@seZdZdd�Zdd�ZdS)rcCstj|tdd|d�dSr_)rr4�RECURSIVE_MUTEXr`rrrr4�szRLock.__init__cCs�z||j��rBt��j}t��jdkr6|dt��j7}|j��}n8|j��dkrZd\}}n |j��dkrrd\}}nd\}}Wnt	y�d\}}Yn0d	|j
j||fS)
Nrarbr)rcrr)rd�nonzero)rerk)rXrX�<%s(%s, %s)>)rrfr
rGr(rgrhrirVrYrZrK)r,r(�countrrrr\�s



zRLock.__repr__Nr^rrrrr�src@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,�lockr0rrrr4�s
zCondition.__init__cCst�|�|j|j|j|jfSr)r	r=rorprqrrr8rrrrA�s
�zCondition.__getstate__cCs |\|_|_|_|_|��dSr)rorprqrrr&rCrrrrE�s�
zCondition.__setstate__cCs
|j��Sr)ror9r8rrrr9�szCondition.__enter__cGs|jj|�Sr)ror:r;rrrr:�szCondition.__exit__cCs|jj|_|jj|_dSr)ror6r7r8rrrr&�s
zCondition._make_methodscCsHz|jj��|jj��}Wnty2d}Yn0d|jj|j|fS)NrXrl)rprrVrqrYrZrKro)r,�num_waitersrrrr\�s

�
zCondition.__repr__c	Cs�|jj��sJd��|j��|jj��}t|�D]}|j��q2zD|j�d|�W|j	��t|�D]}|j��qdS]}|j��qvn$|j	��t|�D]}|j��q�0dS)Nz,must acquire() condition before using wait()T)
rorrfrpr7rir rrr6rq)r,�timeoutrmr2rrr�wait�s&�

��
zCondition.waitrcCs�|jj��sJd��|j�d�r(Jd��|j�d�rN|j�d�}|s(Jd��q(d}||krz|j�d�rz|j��|d7}qR|r�t|�D]}|j��q�|j�d�r�q�dS)Nzlock is not ownedFz<notify: Should not have been able to acquire _wait_semaphorez>notify: Bug in sleeping_count.acquire- res should not be Falserr)	rorrfrrr6rqrpr7r )r,�n�res�sleepersr2rrr�notifys$��

zCondition.notifycCs|jtjd�dS)N)rw)rzr�maxsizer8rrr�
notify_all(szCondition.notify_allcCsd|�}|r|S|dur$t��|}nd}d}|s`|durN|t��}|dkrNq`|�|�|�}q,|Srn)�time�	monotonicrv)r,�	predicateru�result�endtime�waittimerrr�wait_for+s
zCondition.wait_for)N)N)r)N)rKrLrMr4rArEr9r:r&r\rvrzr|r�rrrrr�s


rc@s6eZdZdd�Zdd�Zdd�Zdd�Zdd
d�Zd	S)
rcCs |�|���|_|�d�|_dSrn)rr�_condr�_flagr`rrrr4CszEvent.__init__cCsR|j�8|j�d�r.|j��Wd�dSWd�dS1sD0YdS�NFT)r�r�r6r7r8rrr�is_setGs

zEvent.is_setcCsJ|j�0|j�d�|j��|j��Wd�n1s<0YdS�NF)r�r�r6r7r|r8rrr�setNs
z	Event.setcCs6|j�|j�d�Wd�n1s(0YdSr�)r�r�r6r8rrr�clearTszEvent.clearNcCsv|j�\|j�d�r |j��n|j�|�|j�d�rR|j��Wd�dSWd�dS1sh0YdSr�)r�r�r6r7rv)r,rurrrrvXs
z
Event.wait)N)rKrLrMr4r�r�r�rvrrrrrAs
rc@sZeZdZddd�Zdd�Zdd�Zedd	��Zejd
d	��Zedd��Z	e	jd
d��Z	dS)�BarrierNc	CsRddl}ddlm}||�d�d�}|��}|�|||||f�d|_d|_dS)Nrr)�
BufferWrapperr2r)�struct�heapr��calcsizerrE�_stateri)	r,�parties�actionrur0r�r��wrapper�condrrrr4jszBarrier.__init__cCs.|\|_|_|_|_|_|j���d�|_dS)Nr2)�_parties�_action�_timeoutr��_wrapper�create_memoryview�cast�_arrayrCrrrrEss�zBarrier.__setstate__cCs|j|j|j|j|jfSr)r�r�r�r�r�r8rrrrAxs�zBarrier.__getstate__cCs
|jdSrn�r�r8rrrr�|szBarrier._statecCs||jd<dSrnr�r[rrrr��scCs
|jdS�Nrr�r8rrrri�szBarrier._countcCs||jd<dSr�r�r[rrrri�s)NN)
rKrLrMr4rErA�propertyr��setterrirrrrr�hs
	


r�)�__all__rgrrNr!r}�r	r
rrr
�ImportError�listr rjrSrT�objectrrrrrrr�rrrr�<module>
s,	Mo'

Zerion Mini Shell 1.0