AlkantarClanX12

Your IP : 18.119.121.234


Current Path : /opt/alt/python37/lib64/python3.7/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/multiprocessing/__pycache__/process.cpython-37.pyc

B

� f4)�@sdddgZddlZddlZddlZddlZddlZddlmZyej�	e�
��ZWnek
rjdZYnXdd�Z
dd�Zdd	�ZGd
d�de�ZGdd�de�ZGd
d�de�Ze�ae�d�ae�a[iZx<eej���D]*\ZZedd�dkr�dekr�eee<q�We�Z dS)�BaseProcess�current_process�active_children�N)�WeakSetcCstS)z@
    Return process object representing the current process
    )�_current_process�rr�</opt/alt/python37/lib64/python3.7/multiprocessing/process.pyr$scCst�tt�S)zN
    Return list of process objects corresponding to live child processes
    )�_cleanup�list�	_childrenrrrrr*scCs.x(tt�D]}|j��dk	r
t�|�q
WdS)N)r
r�_popen�poll�discard)�prrrr	5sr	c@s�eZdZdZdd�Zddddifdd�dd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
d,dd�Zdd�Zdd�Z
edd��Zejdd��Zedd��Zejdd��Zedd ��Zejd!d ��Zed"d#��Zed$d%��ZeZed&d'��Zd(d)�Zd*d+�ZdS)-rz�
    Process objects represent activity that is run in a separate process

    The class is analogous to `threading.Thread`
    cCst�dS)N)�NotImplementedError)�selfrrr�_PopenEszBaseProcess._PopenNr)�daemoncCs�|dkstd��tt�}tj|f|_tj��|_t��|_	d|_
d|_||_t
|�|_t|�|_|p�t|�jdd�dd�|jD��|_|dk	r�||_t�|�dS)Nz#group argument must be None for nowF�-�:css|]}t|�VqdS)N)�str)�.0�irrr�	<genexpr>Usz'BaseProcess.__init__.<locals>.<genexpr>)�AssertionError�next�_process_counterr�	_identity�_config�copy�os�getpid�_parent_pidr�_closed�_target�tuple�_args�dict�_kwargs�type�__name__�join�_namer�	_dangling�add)r�group�target�name�args�kwargsr�countrrr�__init__Hs


zBaseProcess.__init__cCs|jrtd��dS)Nzprocess object is closed)r#�
ValueError)rrrr�
_check_closedZszBaseProcess._check_closedcCs|jr|j|j|j�dS)zQ
        Method to be run in sub-process; can be overridden in sub-class
        N)r$r&r()rrrr�run^szBaseProcess.runcCsz|��|jdkstd��|jt��ks0td��tj�d�rDtd��t	�|�
|�|_|jj|_|`
|`|`t�|�dS)z%
        Start child process
        Nzcannot start a process twicez:can only start a process object created by current processrz3daemonic processes are not allowed to have children)r7rrr"r r!rr�getr	r�sentinel�	_sentinelr$r&r(rr.)rrrr�startes
zBaseProcess.startcCs|��|j��dS)zT
        Terminate process; sends SIGTERM signal or uses TerminateProcess()
        N)r7r�	terminate)rrrrr=wszBaseProcess.terminatecCs|��|j��dS)zT
        Terminate process; sends SIGKILL signal or uses TerminateProcess()
        N)r7r�kill)rrrrr>~szBaseProcess.killcCsR|��|jt��kstd��|jdk	s0td��|j�|�}|dk	rNt�|�dS)z5
        Wait until child process terminates
        zcan only join a child processNzcan only join a started process)	r7r"r r!rr�waitrr)rZtimeoutZresrrrr+�szBaseProcess.joincCs`|��|tkrdS|jt��ks*td��|jdkr8dS|j��}|dkrNdSt�	|�dSdS)z1
        Return whether process is alive
        Tzcan only test a child processNF)
r7rr"r r!rrr
rr)r�
returncoderrr�is_alive�s


zBaseProcess.is_alivecCsH|jdk	r>|j��dkr td��|j��d|_|`t�|�d|_dS)z�
        Close the Process object.

        This method releases resources held by the Process object.  It is
        an error to call this method if the child process is still running.
        Nz^Cannot close a process while it is still running. You should first call join() or terminate().T)rr
r6�closer;rrr#)rrrrrB�s


zBaseProcess.closecCs|jS)N)r,)rrrrr1�szBaseProcess.namecCst|t�std��||_dS)Nzname must be a string)�
isinstancerrr,)rr1rrrr1�scCs|j�dd�S)z4
        Return whether process is a daemon
        rF)rr9)rrrrr�szBaseProcess.daemoncCs |jdkstd��||jd<dS)z1
        Set whether process is a daemon
        Nzprocess has already startedr)rrr)rZdaemonicrrrr�scCs
|jdS)N�authkey)r)rrrrrD�szBaseProcess.authkeycCst|�|jd<dS)z2
        Set authorization key of process
        rDN)�AuthenticationStringr)rrDrrrrD�scCs"|��|jdkr|jS|j��S)zM
        Return exit code of process or `None` if it has yet to stop
        N)r7rr
)rrrr�exitcode�s
zBaseProcess.exitcodecCs*|��|tkrt��S|jo$|jjSdS)zU
        Return identifier (PID) of process or `None` if it has yet to start
        N)r7rr r!r�pid)rrrr�ident�szBaseProcess.identcCs2|��y|jStk
r,td�d�YnXdS)z{
        Return a file descriptor (Unix) or handle (Windows) suitable for
        waiting for process termination.
        zprocess not startedN)r7r;�AttributeErrorr6)rrrrr:�s
zBaseProcess.sentinelcCs�|tkrd}nJ|jrd}n>|jt��kr.d}n*|jdkr>d}n|j��dk	rT|j}nd}t|�t	kr�|dkrrd}ndt
�||�}dt|�j|j
||jr�d	p�d
fS)NZstarted�closed�unknown�initialrZstoppedzstopped[%s]z<%s(%s, %s%s)>z daemon�)rr#r"r r!rr
rFr)�int�_exitcode_to_namer9r*r,r)rZstatusrrr�__repr__�s"
zBaseProcess.__repr__c
CsRddlm}m}�zy||jdk	r,|�|j�t�d�at�a	|�
�t}|az|j�
�|��Wd~X|�d�z|��d}Wd|��XWn�tk
r�}zJ|js�d}n:t|jdt�r�|jd}ntj�t|jd�d�d}Wdd}~XYn2d}ddl}tj�d|j�|��YnXWdt��|�d|�|��X|S)N�)�util�contextz child process calling self.run()r�
zProcess %s:
z process exiting with exitcode %d) rMrRrSZ
_start_methodZ_force_start_method�	itertoolsr4r�setrZ_close_stdinrZ_finalizer_registry�clearZ_run_after_forkers�infor8Z_exit_function�
SystemExitr2rCrN�sys�stderr�writer�	tracebackr1�	print_exc�	threadingZ	_shutdownZ_flush_std_streams)rrRrSZold_processrF�er]rrr�
_bootstrapsD




zBaseProcess._bootstrap)N)r*�
__module__�__qualname__�__doc__rr5r7r8r<r=r>r+rArB�propertyr1�setterrrDrFrHrGr:rPrarrrrr?s0

c@seZdZdd�ZdS)rEcCs,ddlm}|�dkrtd��tt|�ffS)NrQ)�get_spawning_popenzJPickling an AuthenticationString object is disallowed for security reasons)rSrg�	TypeErrorrE�bytes)rrgrrr�
__reduce__Fs

zAuthenticationString.__reduce__N)r*rbrcrjrrrrrEEsrEc@seZdZdd�Zdd�ZdS)�_MainProcesscCs8d|_d|_d|_d|_d|_tt�d��dd�|_dS)NrZMainProcessF� z/mp)rDZ	semprefix)	rr,r"rr#rEr �urandomr)rrrrr5Usz_MainProcess.__init__cCsdS)Nr)rrrrrBgsz_MainProcess.closeN)r*rbrcr5rBrrrrrkSsrkrQ�ZSIG�_)!�__all__r rZ�signalrUr_Z_weakrefsetr�path�abspath�getcwdZORIGINAL_DIR�OSErrorrrr	�objectrrirErkrr4rrVrrOr
�__dict__�itemsr1Zsignumr-rrrr�<module>
s6