Your IP : 18.191.72.220


Current Path : /opt/alt/python34/lib64/python3.4/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/multiprocessing/__pycache__/context.cpython-34.pyc

�
e f�)�@s[ddlZddlZddlZddlmZgZGdd�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�Zie�d!6e�d"6e�d#6Zeed!�ZnOGd$d�dej
�ZGd%d�de�Zie�d"6Zeed"�Zd&d'�Zej�Zd(d)�Zd*d+�Zd,d-�Z dS).�N�)�processc@seZdZdS)�ProcessErrorN)�__name__�
__module__�__qualname__�rr�</opt/alt/python34/lib64/python3.4/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$dd;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?tjdkr;ttdd�r;ddlm}|�ndS)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)rrIrrr	�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@rArCrrLrMrHrrrr	r
sF	
r
c@s(eZdZdZedd��ZdS)�ProcessNcCstj�jj|�S)N)�_default_contextrrO�_Popen)�process_objrrr	rQ�szProcess._Popen)rrr�
_start_methodrNrQrrrr	rO�srOcsaeZdZeZdd�Zd�fdd�Zddd�Zdd	d
�Zdd�Z�S)
�DefaultContextcCs||_d|_dS)N)rP�_actual_context)rr+rrr	�__init__�s	zDefaultContext.__init__NcsE|dkr1|jdkr*|j|_n|jSt�j|�SdS)N)rUrP�superr)rrI)�	__class__rr	r�s
zDefaultContext.get_contextFcCsZ|jdk	r%|r%td��n|dkrD|rDd|_dS|j|�|_dS)Nzcontext has already been set)rU�RuntimeErrorr)rrIZforcerrr	rM�s	zDefaultContext.set_start_methodcCs2|jdkr(|rdS|j|_n|jjS)N)rUrPrJ)rrKrrr	rL�s
zDefaultContext.get_start_methodcCsJtjdkrdgSddlm}|jr<dddgSddgSdS)Nr4r:r)�	reduction�forkrD)r7r8r?rZ�HAVE_SEND_HANDLE)rrZrrr	�get_all_start_methods�s	
z$DefaultContext.get_all_start_methods)	rrrrOrVrrMrLr]rr)rXr	rT�srTccs%|]}|ddkr|VqdS)r�_Nr)�.0�xrrr	�	<genexpr>�srar4c@s(eZdZdZedd��ZdS)�ForkProcessr[cCsddlm}||�S)Nr)�Popen)Z
popen_forkrc)rRrcrrr	rQszForkProcess._PopenN)rrrrSrNrQrrrr	rbsrbc@s(eZdZdZedd��ZdS)�SpawnProcessr:cCsddlm}||�S)Nr)rc)Zpopen_spawn_posixrc)rRrcrrr	rQszSpawnProcess._PopenN)rrrrSrNrQrrrr	rd
srdc@s(eZdZdZedd��ZdS)�ForkServerProcessrDcCsddlm}||�S)Nr)rc)Zpopen_forkserverrc)rRrcrrr	rQszForkServerProcess._PopenN)rrrrSrNrQrrrr	resrec@seZdZdZeZdS)�ForkContextr[N)rrrrJrbrOrrrr	rfsrfc@seZdZdZeZdS)�SpawnContextr:N)rrrrJrdrOrrrr	rgsrgc@s(eZdZdZeZdd�ZdS)�ForkServerContextrDcCs,ddlm}|js(td��ndS)Nr)rZz%forkserver start method not available)r?rZr\rG)rrZrrr	rH&s	z"ForkServerContext._check_availableN)rrrrJrerOrHrrrr	rh#srhr[r:rDc@s(eZdZdZedd��ZdS)rdr:cCsddlm}||�S)Nr)rc)Zpopen_spawn_win32rc)rRrcrrr	rQ6szSpawnProcess._PopenN)rrrrSrNrQrrrr	rd4sc@seZdZdZeZdS)rgr:N)rrrrJrdrOrrrr	rg;scCst|t_dS)N)rErPrU)rIrrr	�_force_start_methodHsricCsttdd�S)N�spawning_popen)r9�_tlsrrrr	�get_spawning_popenQsrlcCs
|t_dS)N)rkrj)�popenrrr	�set_spawning_popenTsrncCs/t�dkr+tdt|�j��ndS)NzF%s objects should only be shared between processes through inheritance)rlrY�typer)�objrrr	�assert_spawningWsrq)!rr7Z	threadingr?r�__all__�	Exceptionrr
rr�objectr
ZBaseProcessrOrT�list�dirr8rbrdrerfrgrhrErPriZlocalrkrlrnrqrrrr	�<module>sD�("





?>