Your IP : 3.133.148.222


Current Path : /opt/alt/python310/lib64/python3.10/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/multiprocessing/__pycache__/context.cpython-310.pyc

o

6��fM-�@s�ddlZddlZddlZddlmZddlmZdZGdd�de�ZGdd	�d	e�Z	Gd
d�de�Z
Gdd
�d
e�ZGdd�de�Z
Gdd�dej�ZGdd�de
�Zejdkr�Gdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�de
�ZGdd�de
�ZGdd �d e
�Ze�e�e�d!�Zejd"kr�eed#�Zn#eed$�ZnGd%d�dej�ZGd&d�de
�Zd#e�iZeed#�Zd'd(�Ze��Zd)d*�Zd+d,�Zd-d.�ZdS)/�N�)�process)�	reduction�c@�eZdZdS)�ProcessErrorN��__name__�
__module__�__qualname__rrr�>/opt/alt/python310/lib64/python3.10/multiprocessing/context.pyr�rc@r)�BufferTooShortNrrrrrrr
rc@r)�TimeoutErrorNrrrrrrr
rc@r)�AuthenticationErrorNrrrrrrr
rc@s\eZdZeZeZeZeZeej	�Z	eej
�Z
eej�Zdd�Zdd�Z
dCdd�Zdd	�Zd
d�ZdDd
d�ZdEdd�ZdEdd�Zdd�ZdFdd�ZdGdd�ZdGdd�Zdd�Z		dHd d!�Zd"d#�Zd$d%�Zdd&�d'd(�Zdd&�d)d*�Zd+d,�Zd-d.�ZdDd/d0�Z d1d2�Z!d3d4�Z"d5d6�Z#dDd7d8�Z$dId:d;�Z%dId<d=�Z&e'd>d?��Z(e(j)d@d?��Z(dAdB�Z*dS)J�BaseContextcCst��}|durtd��|S)z(Returns the number of CPUs in the systemNzcannot determine number of cpus)�os�	cpu_count�NotImplementedError)�selfZnumrrrr)szBaseContext.cpu_countcCs&ddlm}||��d�}|��|S)z�Returns a manager associated with a running server process

        The managers methods such as `Lock()`, `Condition()` and `Queue()`
        can be used to create shared objects.
        r)�SyncManager��ctx)Zmanagersr�get_context�start)rr�mrrr�Manager1szBaseContext.ManagerTcC�ddlm}||�S)z1Returns two connection object connected by a piper)�Pipe)�
connectionr)rZduplexrrrrr<�zBaseContext.PipecC�ddlm}||��d�S)z#Returns a non-recursive lock objectr)�Lockr)�synchronizer"r)rr"rrrr"A�zBaseContext.LockcCr!)zReturns a recursive lock objectr)�RLockr)r#r%r)rr%rrrr%Fr$zBaseContext.RLockNcC�ddlm}|||��d�S)zReturns a condition objectr)�	Conditionr)r#r'r)r�lockr'rrrr'K�zBaseContext.ConditionrcCr&)zReturns a semaphore objectr)�	Semaphorer)r#r*r)r�valuer*rrrr*Pr)zBaseContext.SemaphorecCr&)z"Returns a bounded semaphore objectr)�BoundedSemaphorer)r#r,r)rr+r,rrrr,Ur)zBaseContext.BoundedSemaphorecCr!)zReturns an event objectr)�Eventr)r#r-r)rr-rrrr-Zr$zBaseContext.EventcC� ddlm}|||||��d�S)zReturns a barrier objectr)�Barrierr)r#r/r)rZparties�actionZtimeoutr/rrrr/_szBaseContext.BarrierrcCr&)�Returns a queue objectr)�Queuer)�queuesr2r)r�maxsizer2rrrr2dr)zBaseContext.QueuecCr&)r1r)�
JoinableQueuer)r3r5r)rr4r5rrrr5ir)zBaseContext.JoinableQueuecCr!)r1r)�SimpleQueuer)r3r6r)rr6rrrr6nr$zBaseContext.SimpleQueuercCs"ddlm}||||||��d�S)zReturns a process pool objectr)�Pool)�context)Zpoolr7r)rZ	processesZinitializerZinitargsZmaxtasksperchildr7rrrr7ss
�zBaseContext.PoolcGsddlm}||g|�R�S)zReturns a shared objectr)�RawValue)�sharedctypesr9)r�typecode_or_type�argsr9rrrr9zr)zBaseContext.RawValuecCsddlm}|||�S)zReturns a shared arrayr)�RawArray)r:r=)rr;�size_or_initializerr=rrrr=s
zBaseContext.RawArray)r(cGs(ddlm}||g|�R||��d��S)z$Returns a synchronized shared objectr)�Value�r(r)r:r?r)rr;r(r<r?rrrr?�s�zBaseContext.ValuecCr.)z#Returns a synchronized shared arrayr)�Arrayr@)r:rAr)rr;r>r(rArrrrA�s�zBaseContext.ArraycCs4tjdkrttdd�rddlm}|�dSdSdS)z�Check whether this is a fake forked process in a frozen executable.
        If so then run code specified by commandline and exit.
        �win32�frozenFr)�freeze_supportN)�sys�platform�getattr�spawnrD)rrDrrrrD�s
�zBaseContext.freeze_supportcCsddlm}|�S)zZReturn package logger -- if it does not already exist then
        it is created.
        r)�
get_logger)�utilrI)rrIrrrrI�szBaseContext.get_loggercCr)z8Turn on logging and add a handler which prints to stderrr)�
log_to_stderr)rJrK)r�levelrKrrrrK�r zBaseContext.log_to_stderrcCsddlm}dS)zVInstall support for sending connections and sockets
        between processes
        r)rN)�r)rrrrr�allow_connection_pickling�sz%BaseContext.allow_connection_picklingcC�ddlm}||�dS)z�Sets the path to a python.exe or pythonw.exe binary used to run
        child processes instead of sys.executable when using the 'spawn'
        start method.  Useful for people embedding Python.
        r)�set_executableN)rHrP)r�
executablerPrrrrP�szBaseContext.set_executablecCrO)zkSet list of module names to try to load in forkserver process.
        This is really just a hint.
        r)�set_forkserver_preloadN)�
forkserverrR)rZmodule_namesrRrrrrR�sz"BaseContext.set_forkserver_preloadcCsB|dur|Szt|}Wntytd|�d�w|��|S)Nzcannot find context for %r)�_concrete_contexts�KeyError�
ValueError�_check_available)r�methodrrrrr�s�zBaseContext.get_contextFcCs|jS�N)�_name�rZ
allow_nonerrr�get_start_method�szBaseContext.get_start_methodcCstd��)Nz+cannot set start method of concrete context)rV�rrXZforcerrr�set_start_method�szBaseContext.set_start_methodcCst��d�S)z_Controls how objects will be reduced to a form that can be
        shared with other processes.r)�globals�get�rrrr�reducer�szBaseContext.reducercCs|t�d<dS)Nr)r_)rrrrrrb��cC�dSrYrrarrrrW�szBaseContext._check_available)TrY)r)NN)r)NNrN�F)+r	r
rrrrr�staticmethodrZcurrent_processZparent_processZactive_childrenrrrr"r%r'r*r,r-r/r2r5r6r7r9r=r?rArDrIrKrNrPrRrr\r^�propertyrb�setterrWrrrrrsT










�






rc@s(eZdZdZedd��Zedd��ZdS)�ProcessNcCst��j�|�SrY)�_default_contextrri�_Popen)�process_objrrrrk�szProcess._PopencCst��j��SrY)rjrri�_after_forkrrrrrm�rczProcess._after_fork�r	r
r�
_start_methodrfrkrmrrrrri�s
ricsFeZdZeZdd�Zd
�fdd�	Zddd�Zdd	d
�Zdd�Z�Z	S)�DefaultContextcCs||_d|_dSrY)rj�_actual_context)rr8rrr�__init__�s
zDefaultContext.__init__Ncs,|dur|jdur
|j|_|jSt��|�SrY)rqrj�superr)rrX��	__class__rrr�s

zDefaultContext.get_contextFcCs<|jdur|std��|dur|rd|_dS|�|�|_dS)Nzcontext has already been set)rq�RuntimeErrorrr]rrrr^�szDefaultContext.set_start_methodcCs"|jdur
|r	dS|j|_|jjSrY)rqrjrZr[rrrr\�s

zDefaultContext.get_start_methodcCs>tjdkrdgStjdkrddgnddg}tjr|�d�|S)NrBrH�darwin�forkrS)rErFr�HAVE_SEND_HANDLE�append)r�methodsrrr�get_all_start_methodss

z$DefaultContext.get_all_start_methodsrYre)
r	r
rrirrrr^r\r|�
__classcell__rrrtrrp�s

rprBc@�eZdZdZedd��ZdS)�ForkProcessrxcC�ddlm}||�S�Nr)�Popen)Z
popen_forkr��rlr�rrrrkr zForkProcess._PopenN�r	r
rrorfrkrrrrr�rc@�(eZdZdZedd��Zedd��ZdS)�SpawnProcessrHcCr�r�)Zpopen_spawn_posixr�r�rrrrkr �SpawnProcess._PopencCrdrYrrrrrrm"��SpawnProcess._after_forkNrnrrrrr��
r�c@r~)�ForkServerProcessrScCr�r�)Zpopen_forkserverr�r�rrrrk)r zForkServerProcess._PopenNr�rrrrr�'r�r�c@�eZdZdZeZdS)�ForkContextrxN)r	r
rrZrrirrrrr�.�r�c@r���SpawnContextrHN�r	r
rrZr�rirrrrr�2r�r�c@seZdZdZeZdd�ZdS)�ForkServerContextrScCstjstd��dS)Nz%forkserver start method not available)rryrVrarrrrW9s�z"ForkServerContext._check_availableN)r	r
rrZr�rirWrrrrr�6sr�)rxrHrSrwrHrxc@r�)r�rHcCr�r�)Zpopen_spawn_win32r�r�rrrrkMr r�cCrdrYrrrrrrmRr�r�Nrnrrrrr�Kr�c@r�r�r�rrrrr�Wr�cCst|t_dSrY)rTrjrq)rXrrr�_force_start_methoddsr�cCsttdd�S)N�spawning_popen)rG�_tlsrrrr�get_spawning_popenmsr�cCs
|t_dSrY)r�r�)�popenrrr�set_spawning_popenps
r�cCs t�durtdt|�j��dS)NzF%s objects should only be shared between processes through inheritance)r�rv�typer	)�objrrr�assert_spawningss
���r�) rrEZ	threadingrMrr�__all__�	Exceptionrrrr�objectrZBaseProcessrirprFrr�r�r�r�r�rTrjr�Zlocalr�r�r�r�rrrr�<module>sL?

,�
�

?>