Your IP : 3.144.6.9


Current Path : /opt/alt/python38/lib64/python3.8/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/multiprocessing/__pycache__/process.cpython-38.opt-1.pyc

U

i�f�.�@s8ddddgZddlZddlZddlZddlZddlZddlmZzej�	e�
��ZWnek
rldZYnXdd�Z
dd�Zd	d�Zd
d�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�Zdae�ae�d�ae�a[iZeej� ��D]0\Z!Z"e!dd�dkr�de!kr�de!��ee"<q�e�Z#dS)�BaseProcess�current_process�active_children�parent_process�N)�WeakSetcCstS)z@
    Return process object representing the current process
    )�_current_process�rr�</opt/alt/python38/lib64/python3.8/multiprocessing/process.pyr%scCst�tt�S)zN
    Return list of process objects corresponding to live child processes
    )�_cleanup�list�	_childrenrrrr	r+scCstS)z?
    Return process object representing the parent process
    )�_parent_processrrrr	r3scCs*tt�D]}|j��dk	rt�|�qdS�N)rr�_popen�poll�discard)�prrr	r
=sr
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*d+�ZdS).rz�
    Process objects represent activity that is run in a separate process

    The class is analogous to `threading.Thread`
    cCst�dSr)�NotImplementedError��selfrrr	�_PopenMszBaseProcess._PopenNr)�daemoncCs�tt�}tj|f|_tj��|_t��|_tj	|_
d|_d|_||_
t|�|_t|�|_|p�t|�jdd�dd�|jD��|_|dk	r�||_t�|�dS)NF�-�:css|]}t|�VqdSr)�str)�.0�irrr	�	<genexpr>^sz'BaseProcess.__init__.<locals>.<genexpr>)�next�_process_counterr�	_identity�_config�copy�os�getpid�_parent_pid�name�_parent_namer�_closed�_target�tuple�_args�dict�_kwargs�type�__name__�join�_namer�	_dangling�add)r�group�targetr&�args�kwargsr�countrrr	�__init__Ps 


�zBaseProcess.__init__cCs|jrtd��dS)Nzprocess object is closed)r(�
ValueErrorrrrr	�
_check_closedcszBaseProcess._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	�rungszBaseProcess.runcCs>|��t�|�|�|_|jj|_|`|`|`t	�
|�dS)z%
        Start child process
        N)r;r
rr�sentinel�	_sentinelr)r+r-rr3rrrr	�startns
zBaseProcess.startcCs|��|j��dS)zT
        Terminate process; sends SIGTERM signal or uses TerminateProcess()
        N)r;r�	terminaterrrr	r@�szBaseProcess.terminatecCs|��|j��dS)zT
        Terminate process; sends SIGKILL signal or uses TerminateProcess()
        N)r;r�killrrrr	rA�szBaseProcess.killcCs*|��|j�|�}|dk	r&t�|�dS)z5
        Wait until child process terminates
        N)r;r�waitrr)r�timeout�resrrr	r0�szBaseProcess.joincCsJ|��|tkrdS|jdkr"dS|j��}|dkr8dSt�|�dSdS)z1
        Return whether process is alive
        TNF)r;rrrrr)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)rrr:�closer>rrr(rrrr	rG�s


zBaseProcess.closecCs|jSr�r1rrrr	r&�szBaseProcess.namecCs
||_dSrrH)rr&rrr	r&�scCs|j�dd�S)z4
        Return whether process is a daemon
        rF)r!�getrrrr	r�szBaseProcess.daemoncCs||jd<dS)z1
        Set whether process is a daemon
        rN�r!)rZdaemonicrrr	r�scCs
|jdS)N�authkeyrJrrrr	rK�szBaseProcess.authkeycCst|�|jd<dS)z2
        Set authorization key of process
        rKN)�AuthenticationStringr!)rrKrrr	rK�scCs"|��|jdkr|jS|j��S)zM
        Return exit code of process or `None` if it has yet to stop
        N)r;rrrrrr	�exitcode�s
zBaseProcess.exitcodecCs*|��|tkrt��S|jo$|jjSdS)zU
        Return identifier (PID) of process or `None` if it has yet to start
        N)r;rr#r$r�pidrrrr	�ident�szBaseProcess.identcCs4|��z|jWStk
r.td�d�YnXdS)z{
        Return a file descriptor (Unix) or handle (Windows) suitable for
        waiting for process termination.
        zprocess not startedN)r;r>�AttributeErrorr:rrrr	r=�s
zBaseProcess.sentinelcCs�d}|tkrd}nL|jrd}n@|jt��kr2d}n,|jdkrBd}n|j��}|dk	rZd}nd}t|�jd|j	g}|jdk	r�|�
d|jj�|�
d|j�|�
|�|dk	r�t�
||�}|�
d	|�|jr�|�
d
�dd�|�S)
NZstarted�closed�unknown�initialZstoppedzname=%rzpid=%sz	parent=%szexitcode=%srz<%s>� )rr(r%r#r$rrr.r/r1�appendrN�_exitcode_to_namerIrr0)rrMZstatus�inforrr	�__repr__s0




zBaseProcess.__repr__c
Csvddlm}m}�z>z�|jdk	r,|�|j�t	�
d�at�a
|��t}|at|j|j|�atjrnt����z|j��|��W5~X|�d�z|��d}W5|��XWn�tk
�r}zJ|js�d}n:t|jdt�r�|jd}nt j!�"t#|jd�d�d}W5d}~XYn2d}ddl$}t j!�"d|j%�|�&�YnXW5t��|�d|�|��X|S)N�)�util�contextz process exiting with exitcode %dz child process calling self.run()r�
zProcess %s:
)'�rZr[�	threadingZ	_shutdownrWZ_flush_std_streamsZ
_start_methodZ_force_start_method�	itertoolsr8r�setrZ_close_stdinr�_ParentProcessr'r%r
Z_HAVE_THREAD_NATIVE_IDZmain_threadZ_set_native_idZ_finalizer_registry�clearZ_run_after_forkersZ_exit_functionr<�
SystemExitr6�
isinstance�int�sys�stderr�writer�	tracebackr&�	print_exc)rZparent_sentinelrZr[rMZold_process�erirrr	�
_bootstrap"sR

�


zBaseProcess._bootstrap)N)N)r/�
__module__�__qualname__�__doc__rr9r;r<r?r@rAr0rFrG�propertyr&�setterrrKrMrOrNr=rXrlrrrr	rGsD�







	


c@seZdZdd�ZdS)rLcCs,ddlm}|�dkrtd��tt|�ffS)NrY)�get_spawning_popenzJPickling an AuthenticationString object is disallowed for security reasons)r[rr�	TypeErrorrL�bytes)rrrrrr	�
__reduce__Xs
�zAuthenticationString.__reduce__N)r/rmrnrurrrr	rLWsrLc@s6eZdZdd�Zdd�Zedd��Zd
dd	�ZeZdS)racCs4d|_||_||_d|_d|_d|_||_i|_dS)NrF)r r1�_pidr%rr(r>r!)rr&rNr=rrr	r9hsz_ParentProcess.__init__cCsddlm}||jgdd�S)Nr�rB�rC�Zmultiprocessing.connectionrBr>)rrBrrr	rFrsz_ParentProcess.is_alivecCs|jSr)rvrrrr	rOvsz_ParentProcess.identNcCs ddlm}||jg|d�dS)z6
        Wait until parent process terminates
        rrwrxNry)rrCrBrrr	r0zsz_ParentProcess.join)N)	r/rmrnr9rFrprOr0rNrrrr	rafs


rac@seZdZdd�Zdd�ZdS)�_MainProcesscCs8d|_d|_d|_d|_d|_tt�d��dd�|_dS)NrZMainProcessF� z/mp)rKZ	semprefix)	r r1r%rr(rLr#�urandomr!rrrr	r9�s�z_MainProcess.__init__cCsdSrrrrrr	rG�sz_MainProcess.closeN)r/rmrnr9rGrrrr	rz�srzrY�ZSIG�_r)$�__all__r#rf�signalr_r^Z_weakrefsetr�path�abspath�getcwdZORIGINAL_DIR�OSErrorrrrr
�objectrrtrLrarzr
rr8rr`rrVr�__dict__�itemsr&Zsignumr2rrrr	�<module>
s@�


!


?>