Your IP : 3.145.199.240


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



��Yf�)�@sWddlZddlZddlZddlmZgZGdd�de�ZGdd�de�ZGdd	�d	e�Z	Gd
d�de�Z
Gdd
�d
e�ZGdd�dej
�ZGdd�de�Zedd�ee�D��e_ejdkr�Gdd�dej
�ZGdd�dej
�ZGdd�dej
�ZGdd�de�ZGdd�de�ZGdd �d e�Zd!e�d"e�d#e�iZeed!�ZnNGd$d�dej
�ZGd%d�de�Zd"e�iZeed"�Zd&d'�Zej�Zd(d)�Zd*d+�Zd,d-�Z dS).�N�)�processc@seZdZdS)�ProcessErrorN)�__name__�
__module__�__qualname__�rr�</opt/alt/python35/lib64/python3.5/multiprocessing/context.pyr
src@seZdZdS)�BufferTooShortN)rrrrrrr	r
sr
c@seZdZdS)�TimeoutErrorN)rrrrrrr	rsrc@seZdZdS)�AuthenticationErrorN)rrrrrrr	rsrc@s�eZdZeZeZeZeZeej	�Z	eej
�Z
dd�Zdd�Zddd�Z
dd	�Zd
d�Zdd
d�Zddd�Zddd�Zdd�Zdddd�Zddd�Zddd�Zdd�Zddfddd �Zd!d"�Zd#d$�Zd%dd&d'�Zd%dd(d)�Zd*d+�Zd,d-�Zdd.d/�Zd0d1�Z d2d3�Z!d4d5�Z"dd6d7�Z#d8d9d:�Z$d8d;d<�Z%d=d>�Z&dS)?�BaseContextcCs/tj�}|dkr'td��n|SdS)z(Returns the number of CPUs in the systemNzcannot determine number of cpus)�os�	cpu_count�NotImplementedError)�selfZnumrrr	r'szBaseContext.cpu_countcCs3ddlm}|d|j��}|j�|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	�Manager/s
zBaseContext.ManagerTcCsddlm}||�S)z1Returns two connection object connected by a piper)�Pipe)�
connectionr)rZduplexrrrr	r:szBaseContext.PipecCs#ddlm}|d|j��S)z#Returns a non-recursive lock objectr)�Lockr)�synchronizerr)rrrrr	r?szBaseContext.LockcCs#ddlm}|d|j��S)zReturns a recursive lock objectr)�RLockr)rrr)rrrrr	rDszBaseContext.RLockNcCs&ddlm}||d|j��S)zReturns a condition objectr)�	Conditionr)rrr)r�lockrrrr	rIszBaseContext.ConditionrcCs&ddlm}||d|j��S)zReturns a semaphore objectr)�	Semaphorer)rrr)r�valuerrrr	rNszBaseContext.SemaphorecCs&ddlm}||d|j��S)z"Returns a bounded semaphore objectr)�BoundedSemaphorer)rr!r)rr r!rrr	r!SszBaseContext.BoundedSemaphorecCs#ddlm}|d|j��S)zReturns an event objectr)�Eventr)rr"r)rr"rrr	r"XszBaseContext.EventcCs,ddlm}||||d|j��S)zReturns a barrier objectr)�Barrierr)rr#r)rZparties�actionZtimeoutr#rrr	r#]szBaseContext.BarrierrcCs&ddlm}||d|j��S)zReturns a queue objectr)�Queuer)�queuesr%r)r�maxsizer%rrr	r%bszBaseContext.QueuecCs&ddlm}||d|j��S)zReturns a queue objectr)�
JoinableQueuer)r&r(r)rr'r(rrr	r(gszBaseContext.JoinableQueuecCs#ddlm}|d|j��S)zReturns a queue objectr)�SimpleQueuer)r&r)r)rr)rrr	r)lszBaseContext.SimpleQueuecCs/ddlm}|||||d|j��S)zReturns a process pool objectr)�Pool�context)Zpoolr*r)rZ	processesZinitializerZinitargsZmaxtasksperchildr*rrr	r*qszBaseContext.PoolcGsddlm}|||�S)zReturns a shared objectr)�RawValue)�sharedctypesr,)r�typecode_or_type�argsr,rrr	r,xszBaseContext.RawValuecCsddlm}|||�S)zReturns a shared arrayr)�RawArray)r-r0)rr.�size_or_initializerr0rrr	r0}szBaseContext.RawArrayrcGs/ddlm}|||d|d|j��S)z$Returns a synchronized shared objectr)�Valuerr)r-r2r)rr.rr/r2rrr	r2�szBaseContext.ValuecCs/ddlm}|||d|d|j��S)z#Returns a synchronized shared arrayr)�Arrayrr)r-r3r)rr.r1rr3rrr	r3�szBaseContext.ArraycCs<tjdkr8ttdd�r8ddlm}|�dS)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�spawnr6)rr6rrr	r6�s!zBaseContext.freeze_supportcCsddlm}|�S)zZReturn package logger -- if it does not already exist then
        it is created.
        r)�
get_logger)�utilr;)rr;rrr	r;�szBaseContext.get_loggercCsddlm}||�S)z8Turn on logging and add a handler which prints to stderrr)�
log_to_stderr)r<r=)r�levelr=rrr	r=�szBaseContext.log_to_stderrcCsddlm}dS)zVInstall support for sending connections and sockets
        between processes
        r)rN)�r)rrrrr	�allow_connection_pickling�sz%BaseContext.allow_connection_picklingcCsddlm}||�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)r:rA)r�
executablerArrr	rA�szBaseContext.set_executablecCsddlm}||�dS)zkSet list of module names to try to load in forkserver process.
        This is really just a hint.
        r)�set_forkserver_preloadN)�
forkserverrC)rZmodule_namesrCrrr	rC�sz"BaseContext.set_forkserver_preloadcCsQ|dkr|Syt|}Wn"tk
rBtd|��YnX|j�|S)Nzcannot find context for %r)�_concrete_contexts�KeyError�
ValueError�_check_available)r�methodrrrr	r�s

zBaseContext.get_contextFcCs|jS)N)�_name)r�
allow_nonerrr	�get_start_method�szBaseContext.get_start_methodcCstd��dS)Nz+cannot set start method of concrete context)rG)rrI�forcerrr	�set_start_method�szBaseContext.set_start_methodcCsdS)Nr)rrrr	rH�szBaseContext._check_available)'rrrrr
rr�staticmethodrZcurrent_processZactive_childrenrrrrrrrr!r"r#r%r(r)r*r,r0r2r3r6r;r=r@rArCrrLrNrHrrrr	r
sF	
r
c@s(eZdZdZedd��ZdS)�ProcessNcCstj�jj|�S)N)�_default_contextrrP�_Popen)�process_objrrr	rR�szProcess._Popen)rrr�
_start_methodrOrRrrrr	rP�srPcsaeZdZeZdd�Zd�fdd�Zddd�Zdd	d
�Zdd�Z�S)
�DefaultContextcCs||_d|_dS)N)rQ�_actual_context)rr+rrr	�__init__�s	zDefaultContext.__init__NcsB|dkr.|jdkr'|j|_|jSt�j|�SdS)N)rVrQ�superr)rrI)�	__class__rr	r�s
zDefaultContext.get_contextFcCsW|jdk	r"|r"td��|dkrA|rAd|_dS|j|�|_dS)Nzcontext has already been set)rV�RuntimeErrorr)rrIrMrrr	rN�s	zDefaultContext.set_start_methodcCs/|jdkr%|rdS|j|_|jjS)N)rVrQrJ)rrKrrr	rL�s
zDefaultContext.get_start_methodcCsJtjdkrdgSddlm}|jr<dddgSddgSdS)Nr4r:r)�	reduction�forkrD)r7r8r?r[�HAVE_SEND_HANDLE)rr[rrr	�get_all_start_methods�s	
z$DefaultContext.get_all_start_methods)	rrrrPrWrrNrLr^rr)rYr	rU�srUccs%|]}|ddkr|VqdS)r�_Nr)�.0�xrrr	�	<genexpr>�srbr4c@s(eZdZdZedd��ZdS)�ForkProcessr\cCsddlm}||�S)Nr)�Popen)Z
popen_forkrd)rSrdrrr	rRszForkProcess._PopenN)rrrrTrOrRrrrr	rcsrcc@s(eZdZdZedd��ZdS)�SpawnProcessr:cCsddlm}||�S)Nr)rd)Zpopen_spawn_posixrd)rSrdrrr	rRszSpawnProcess._PopenN)rrrrTrOrRrrrr	re
srec@s(eZdZdZedd��ZdS)�ForkServerProcessrDcCsddlm}||�S)Nr)rd)Zpopen_forkserverrd)rSrdrrr	rRszForkServerProcess._PopenN)rrrrTrOrRrrrr	rfsrfc@seZdZdZeZdS)�ForkContextr\N)rrrrJrcrPrrrr	rgsrgc@seZdZdZeZdS)�SpawnContextr:N)rrrrJrerPrrrr	rhsrhc@s(eZdZdZeZdd�ZdS)�ForkServerContextrDcCs)ddlm}|js%td��dS)Nr)r[z%forkserver start method not available)r?r[r]rG)rr[rrr	rH&s	z"ForkServerContext._check_availableN)rrrrJrfrPrHrrrr	ri#srir\r:rDc@s(eZdZdZedd��ZdS)rer:cCsddlm}||�S)Nr)rd)Zpopen_spawn_win32rd)rSrdrrr	rR6szSpawnProcess._PopenN)rrrrTrOrRrrrr	re4sc@seZdZdZeZdS)rhr:N)rrrrJrerPrrrr	rh;scCst|t_dS)N)rErQrV)rIrrr	�_force_start_methodHsrjcCsttdd�S)N�spawning_popen)r9�_tlsrrrr	�get_spawning_popenQsrmcCs
|t_dS)N)rlrk)�popenrrr	�set_spawning_popenTsrocCs,t�dkr(tdt|�j��dS)NzF%s objects should only be shared between processes through inheritance)rmrZ�typer)�objrrr	�assert_spawningWsrr)!rr7Z	threadingr?r�__all__�	Exceptionrr
rr�objectr
ZBaseProcessrPrU�list�dirr8rcrerfrgrhrirErQrjZlocalrlrmrorrrrrr	�<module>s@�("			

?>