????

Your IP : 3.142.172.36


Current Path : /lib/python3.10/multiprocessing/__pycache__/
Upload File :
Current File : //lib/python3.10/multiprocessing/__pycache__/synchronize.cpython-310.pyc

o

�*�gZ-�@sgd�ZddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	z
ddlm
Z
mZWney?ed��we
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�|dur	tj��}|��}tjdkp|dk}td�D]}zt�||||�	�|�}|_
Wn	ty5Yqwntd��t�
d|j�|��tjdkrWdd�}	t�||	�|j
jdurydd	lm}
|
|j
jd
�tj|tj|j
jfdd�dSdS)
N�win32�fork�dzcannot find name for semaphorezcreated semlock with handle %scSs|j��dS�N)�_semlock�_after_fork)�obj�r�2/usr/lib/python3.10/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__2s6
��

��zSemLock.__init__cCs"ddlm}t|�||d�dS)Nr)�
unregisterr)r)r5r
)r(r5rrrr+TszSemLock._cleanupcC�|jj|_|jj|_dSr)r�acquire�release�r,rrrr&Z�
zSemLock._make_methodscC�
|j��Sr)r�	__enter__r9rrrr<^�
zSemLock.__enter__cG�|jj|�Sr)r�__exit__�r,�argsrrrr?a�zSemLock.__exit__cCsDt�|�|j}tjdkrt���|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__mszSemLock.__setstate__cCsdt��jdttj�fS)Nz%s-%s�	semprefix)r
�current_process�_config�nextr�_randrrrrr"rs�zSemLock._make_nameN)�__name__�
__module__�__qualname__�tempfile�_RandomNameSequencerPr4�staticmethodr+r&r<r?rGrKr"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}�zSemaphore.__init__cCr;r)r�
_get_valuer9rrr�	get_value�r=zSemaphore.get_valuecCs6z|j��}Wntyd}Ynwd|jj|fS)N�unknownz<%s(value=%s)>)rr]�	Exception�	__class__rQ�r,r.rrr�__repr__�s�zSemaphore.__repr__N�r)rQrRrSr4r^rcrrrrr{s
rc@seZdZddd�Zdd�ZdS)rrcCstj|t|||d�dSrW�rr4rYr[rrrr4�r\zBoundedSemaphore.__init__cCs<z|j��}Wntyd}Ynwd|jj||jjfS)Nr_z<%s(value=%s, maxvalue=%s)>)rr]r`rarQr/rbrrrrc�s��zBoundedSemaphore.__repr__Nrd�rQrRrSr4rcrrrrr�s
rc@�eZdZdd�Zdd�ZdS)rcC�tj|tdd|d�dS�NrrXre�r,r0rrrr4�r\z
Lock.__init__cCs�z3|j��rt��j}t��jdkr|dt��j7}n|j��dkr&d}n|j��dkr0d}nd}Wnt	y>d}Ynwd	|j
j|fS)
N�
MainThread�|r�Noner�SomeOtherThread�SomeOtherProcessr_z<%s(owner=%s)>)r�_is_miner
rMr(�	threading�current_threadr]�_countr`rarQ)r,r(rrrrc�s 

���z
Lock.__repr__Nrfrrrrr��rc@rg)rcCrhri)rr4�RECURSIVE_MUTEXrjrrrr4�r\zRLock.__init__cCs�z>|j��r!t��j}t��jdkr|dt��j7}|j��}n|j��dkr-d\}}n|j��dkr9d\}}nd\}}Wn
t	yKd\}}Ynwd	|j
j||fS)
Nrkrlr)rmrr)rn�nonzero)rorv)r_r_�<%s(%s, %s)>)rrpr
rMr(rqrrrsr]r`rarQ)r,r(�countrrrrc�s 



��zRLock.__repr__Nrfrrrrr�rtrc@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	rCrzr{r|r}r9rrrrG�s
�zCondition.__getstate__cCs |\|_|_|_|_|��dSr)rzr{r|r}r&rIrrrrK�s
�zCondition.__setstate__cCr;r)rzr<r9rrrr<�r=zCondition.__enter__cGr>r)rzr?r@rrrr?�rBzCondition.__exit__cCr6r)rzr7r8r9rrrr&�r:zCondition._make_methodscCsHz|jj��|jj��}Wntyd}Ynwd|jj|j|fS)Nr_rw)r{rr]r|r`rarQrz)r,�num_waitersrrrrc�s

��zCondition.__repr__c	Cs�|jj��s
Jd��|j��|jj��}t|�D]}|j��qz|j�d|�W|j	��t|�D]}|j��q2S|j	��t|�D]}|j��qDw)Nz,must acquire() condition before using wait()T)
rzrrpr{r8rsr r}r7r|)r,�timeoutrxr2rrr�wait�s"�

�
��zCondition.waitrcCs�|jj��s
Jd��|j�d�rJd��|j�d�r,|j�d�}|s&Jd��|j�d�sd}||krK|j�d�rK|j��|d7}||krK|j�d�s8|rht|�D]}|j��qQ|j�d�rj	|j�d�s_dSdSdS)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)	rzrrpr}r7r|r{r8r )r,�n�res�sleepersr2rrr�notifys.���
���zCondition.notifycCs|jtjd�dS)N)r�)r�r�maxsizer9rrr�
notify_all(szCondition.notify_allcCsj|�}|r|S|durt��|}nd}d}|s3|dur)|t��}|dkr)	|S|�|�|�}|r|Sry)�time�	monotonicr�)r,�	predicater��result�endtime�waittimerrr�wait_for+s"
��zCondition.wait_forrrd)rQrRrSr4rGrKr<r?r&rcr�r�r�r�rrrrr�s


rc@s6eZdZdd�Zdd�Zdd�Zdd�Zdd
d�Zd	S)
rcCs |�|���|_|�d�|_dSry)rr�_condr�_flagrjrrrr4CszEvent.__init__cCsV|j�|j�d�r|j��	Wd�dS	Wd�dS1s$wYdS�NFT)r�r�r7r8r9rrr�is_setGs
�$�zEvent.is_setcCsL|j�|j�d�|j��|j��Wd�dS1swYdS�NF)r�r�r7r8r�r9rrr�setNs

"�z	Event.setcCs8|j�|j�d�Wd�dS1swYdSr�)r�r�r7r9rrr�clearTs"�zEvent.clearNcCsz|j�0|j�d�r|j��n|j�|�|j�d�r*|j��	Wd�dS	Wd�dS1s6wYdSr�)r�r�r7r8r�)r,r�rrrr�Xs
�	$�z
Event.waitr)rQrRrSr4r�r�r�r�rrrrrAs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��calcsizerrK�_staters)	r,�parties�actionr�r0r�r��wrapper�condrrrr4js
zBarrier.__init__cCs.|\|_|_|_|_|_|j���d�|_dS)Nr2)�_parties�_action�_timeoutr��_wrapper�create_memoryview�cast�_arrayrIrrrrKss�zBarrier.__setstate__cCs|j|j|j|j|jfSr)r�r�r�r�r�r9rrrrGxs�zBarrier.__getstate__cC�
|jdSry�r�r9rrrr�|�
zBarrier._statecC�||jd<dSryr�rbrrrr���cCr��Nrr�r9rrrrs�r�zBarrier._countcCr�r�r�rbrrrrs�r�)NN)
rQrRrSr4rKrG�propertyr��setterrsrrrrr�hs
	


r�)�__all__rqrrTr!r��r	r
rrr
�ImportError�listr rurYrZ�objectrrrrrrr�rrrr�<module>s0	�
Mo'

Page not found | The NCLEX Doctor

Page not found!

Sorry, this page is not available...