Your IP : 3.142.198.108


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

o

6��f9/�@s2gd�ZddlZddlZddlZddlZddlZddlmZz
ej�	e�
��ZWney3dZYnwdd�Z
dd�Zdd	�Zd
d�ZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�Zdae�ae�d�ae�a[iZeej� ��D]\Z!Z"e!dd�dkr�de!vr�de!��ee"<q{e�Z#dS))�BaseProcess�current_process�active_children�parent_process�N)�WeakSetcC�tS)z@
    Return process object representing the current process
    )�_current_process�r	r	�>/opt/alt/python310/lib64/python3.10/multiprocessing/process.pyr%�rcCst�tt�S)zN
    Return list of process objects corresponding to live child processes
    )�_cleanup�list�	_childrenr	r	r	r
r+srcCr)z?
    Return process object representing the parent process
    )�_parent_processr	r	r	r
r3rrcCs*tt�D]}|j��durt�|�qdS�N)r
r�_popen�poll�discard)�pr	r	r
r=s

��rc@seZdZdZdd�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+�Zed,d-��ZdS)/rz�
    Process objects represent activity that is run in a separate process

    The class is analogous to `threading.Thread`
    cCst�r)�NotImplementedError��selfr	r	r
�_PopenM�zBaseProcess._PopenNr	)�daemoncCs�tt�}tj|f|_tj��|_t��|_tj	|_
d|_d|_||_
t|�|_t|�|_|p@t|�jdd�dd�|jD��|_|durI||_t�|�dS)NF�-�:css�|]}t|�VqdSr)�str)�.0�ir	r	r
�	<genexpr>^s�z'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�countr	r	r
�__init__Ps 


�zBaseProcess.__init__cCs|jrtd��dS)Nzprocess object is closed)r+�
ValueErrorrr	r	r
�
_check_closedcs�zBaseProcess._check_closedcCs"|jr|j|ji|j��dSdS)zQ
        Method to be run in sub-process; can be overridden in sub-class
        N)r,r.r0rr	r	r
�rungs�zBaseProcess.runcCs>|��t�|�|�|_|jj|_|`|`|`t	�
|�dS)z%
        Start child process
        N)r>rrr�sentinel�	_sentinelr,r.r0rr6rr	r	r
�startns
zBaseProcess.startcC�|��|j��dS)zT
        Terminate process; sends SIGTERM signal or uses TerminateProcess()
        N)r>r�	terminaterr	r	r
rD��zBaseProcess.terminatecCrC)zT
        Terminate process; sends SIGKILL signal or uses TerminateProcess()
        N)r>r�killrr	r	r
rF�rEzBaseProcess.killcCs.|��|j�|�}|durt�|�dSdS)z5
        Wait until child process terminates
        N)r>r�waitrr)r�timeout�resr	r	r
r3�s
�zBaseProcess.joincCsF|��|tur
dS|jdurdS|j��}|durdSt�|�dS)z1
        Return whether process is alive
        TNF)r>rrrrr)r�
returncoder	r	r
�is_alive�s


zBaseProcess.is_alivecCsH|jdur|j��durtd��|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=�closerArrr+rr	r	r
rL�s



zBaseProcess.closecC�|jSr�r4rr	r	r
r)��zBaseProcess.namecCs
||_dSrrN)rr)r	r	r
r)�s
cCs|j�dd�S)z4
        Return whether process is a daemon
        rF)r$�getrr	r	r
r�szBaseProcess.daemoncCs||jd<dS)z1
        Set whether process is a daemon
        rN�r$)rZdaemonicr	r	r
r�scCs
|jdS)N�authkeyrQrr	r	r
rR�s
zBaseProcess.authkeycCst|�|jd<dS)z2
        Set authorization key of process
        rRN)�AuthenticationStringr$)rrRr	r	r
rR�scCs"|��|jdur|jS|j��S)zM
        Return exit code of process or `None` if it has yet to stop
        N)r>rrrr	r	r
�exitcode�s

zBaseProcess.exitcodecCs&|��|turt��S|jo|jjS)zU
        Return identifier (PID) of process or `None` if it has yet to start
        )r>rr&r'r�pidrr	r	r
�ident�szBaseProcess.identcCs*|��z|jWStytd�d�w)z{
        Return a file descriptor (Unix) or handle (Windows) suitable for
        waiting for process termination.
        zprocess not startedN)r>rA�AttributeErrorr=rr	r	r
r@�s
�zBaseProcess.sentinelcCs�d}|tur	d}n&|jrd}n |jt��krd}n|jdur!d}n|j��}|dur-d}nd}t|�jd|j	g}|jdurG|�
d|jj�|�
d|j�|�
|�|duret�
||�}|�
d	|�|jrm|�
d
�dd�|�S)
NZstarted�closed�unknown�initialZstoppedzname=%rzpid=%sz	parent=%szexitcode=%srz<%s>� )rr+r(r&r'rrr1r2r4�appendrU�_exitcode_to_namerPrr3)rrTZstatus�infor	r	r
�__repr__s0




zBaseProcess.__repr__c
Cs�ddlm}m}z�zO|jdur|�|j�t�d�at�a	|�
�t}|at|j
|j|�atjr6t����z|��W~n~w|�d�z|��d}W|��n|��wWnYty�}z%|jdurhd}nt|jt�rr|j}n
tj�t|j�d�d}WYd}~n?d}~wd}ddl }tj�d|j!�|�"�YWt�#�|�d|�|�$�|SWt�#�|�d|�|�$�|SWt�#�|�d|�|�$�|St�#�|�d|�|�$�w)N�)�util�contextz child process calling self.run()r�
zProcess %s:
z process exiting with exitcode %d)%�rarbZ
_start_methodZ_force_start_method�	itertoolsr;r"�setrZ_close_stdinr�_ParentProcessr*r(r�	threadingZ_HAVE_THREAD_NATIVE_IDZmain_threadZ_set_native_id�_after_forkr^r?Z_exit_function�
SystemExit�code�
isinstance�int�sys�stderr�writer�	tracebackr)�	print_excZ	_shutdownZ_flush_std_streams)rZparent_sentinelrarbZold_processrT�erqr	r	r
�
_bootstrap"sh


�


�����
zBaseProcess._bootstrapcCs"ddlm}|j��|��dS)Nr`�ra)rdraZ_finalizer_registry�clearZ_run_after_forkersrur	r	r
riRs
zBaseProcess._after_forkr)r2�
__module__�__qualname__�__doc__rr<r>r?rBrDrFr3rKrL�propertyr)�setterrrRrTrVrUr@r_rt�staticmethodrir	r	r	r
rGsJ�







	



0rc@seZdZdd�ZdS)rScCs,ddlm}|�durtd��tt|�ffS)Nr`)�get_spawning_popenzJPickling an AuthenticationString object is disallowed for security reasons)rbr}�	TypeErrorrS�bytes)rr}r	r	r
�
__reduce__^s
�zAuthenticationString.__reduce__N)r2rwrxr�r	r	r	r
rS]srSc@s6eZdZdd�Zdd�Zedd��Zd
dd	�ZeZdS)rgcCs4d|_||_||_d|_d|_d|_||_i|_dS)Nr	F)r#r4�_pidr(rr+rAr$)rr)rUr@r	r	r
r<ns
z_ParentProcess.__init__cCsddlm}||jgdd�S)Nr�rG�rH�Zmultiprocessing.connectionrGrA)rrGr	r	r
rKxsz_ParentProcess.is_alivecCrMr)r�rr	r	r
rV|rOz_ParentProcess.identNcCs ddlm}||jg|d�dS)z6
        Wait until parent process terminates
        rr�r�Nr�)rrHrGr	r	r
r3�sz_ParentProcess.joinr)	r2rwrxr<rKrzrVr3rUr	r	r	r
rgls


rgc@seZdZdd�Zdd�ZdS)�_MainProcesscCs8d|_d|_d|_d|_d|_tt�d��dd�|_dS)Nr	ZMainProcessF� z/mp)rRZ	semprefix)	r#r4r(rr+rSr&�urandomr$rr	r	r
r<�s�z_MainProcess.__init__cCsdSrr	rr	r	r
rL�rz_MainProcess.closeN)r2rwrxr<rLr	r	r	r
r��sr�r`�ZSIG�_r)$�__all__r&rn�signalrerhZ_weakrefsetr�path�abspath�getcwdZORIGINAL_DIR�OSErrorrrrr�objectrrrSrgr�rrr;r"rfrr]r
�__dict__�itemsr)Zsignumr5r	r	r	r
�<module>sB	�

!
�


?>