Your IP : 3.147.51.72


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.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�|dusJd��tt�}tj|f|_tj��|_t��|_tj	|_
d|_d|_||_
t|�|_t|�|_|pHt|�jdd�dd�|jD��|_|durQ||_t�|�dS)Nz#group argument must be None for nowF�-�: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.runcCsz|��|jdus
Jd��|jt��ksJd��tj�d�r"Jd��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)r>rr(r&r'rr$�getrr�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
rE��zBaseProcess.terminatecCrD)zT
        Terminate process; sends SIGKILL signal or uses TerminateProcess()
        N)r>r�killrr	r	r
rG�rFzBaseProcess.killcCsV|��|jt��ksJd��|jdusJd��|j�|�}|dur)t�|�dSdS)z5
        Wait until child process terminates
        zcan only join a child processNzcan only join a started process)r>r(r&r'r�waitrr)r�timeout�resr	r	r
r3�s�zBaseProcess.joincCs\|��|tur
dS|jt��ksJd��|jdurdS|j��}|dur'dSt�|�dS)z1
        Return whether process is alive
        Tzcan only test a child processNF)	r>rr(r&r'rrrr)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=�closerBrrr+rr	r	r
rM�s



zBaseProcess.closecC�|jSr)r4rr	r	r
r)��zBaseProcess.namecCst|t�s	Jd��||_dS)Nzname must be a string)�
isinstancerr4)rr)r	r	r
r)�s
cCs|j�dd�S)z4
        Return whether process is a daemon
        rF)r$r@rr	r	r
r�szBaseProcess.daemoncCs |jdus	Jd��||jd<dS)z1
        Set whether process is a daemon
        Nzprocess has already startedr)rr$)rZdaemonicr	r	r
r�scCs
|jdS)N�authkey)r$rr	r	r
rQ�s
zBaseProcess.authkeycCst|�|jd<dS)z2
        Set authorization key of process
        rQN)�AuthenticationStringr$)rrQr	r	r
rQ�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>rB�AttributeErrorr=rr	r	r
rA�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�appendrT�_exitcode_to_namer@rr3)rrSZstatus�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)%�r`raZ
_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�coderP�int�sys�stderr�writer�	tracebackr)�	print_excZ	_shutdownZ_flush_std_streams)rZparent_sentinelr`raZold_processrS�eror	r	r
�
_bootstrap"sh


�


�����
zBaseProcess._bootstrapcCs"ddlm}|j��|��dS)Nr_�r`)rcr`Z_finalizer_registry�clearZ_run_after_forkersrsr	r	r
rhRs
zBaseProcess._after_forkr)r2�
__module__�__qualname__�__doc__rr<r>r?rCrErGr3rLrM�propertyr)�setterrrQrSrUrTrAr^rr�staticmethodrhr	r	r	r
rGsJ�







	



0rc@seZdZdd�ZdS)rRcCs,ddlm}|�durtd��tt|�ffS)Nr_)�get_spawning_popenzJPickling an AuthenticationString object is disallowed for security reasons)rar{�	TypeErrorrR�bytes)rr{r	r	r
�
__reduce__^s
�zAuthenticationString.__reduce__N)r2rurvr~r	r	r	r
rR]srRc@s6eZdZdd�Zdd�Zedd��Zd
dd	�ZeZdS)rfcCs4d|_||_||_d|_d|_d|_||_i|_dS)Nr	F)r#r4�_pidr(rr+rBr$)rr)rTrAr	r	r
r<ns
z_ParentProcess.__init__cCsddlm}||jgdd�S)Nr�rH�rI�Zmultiprocessing.connectionrHrB)rrHr	r	r
rLxsz_ParentProcess.is_alivecCrNr)rrr	r	r
rU|rOz_ParentProcess.identNcCs ddlm}||jg|d�dS)z6
        Wait until parent process terminates
        rr�r�Nr�)rrIrHr	r	r
r3�sz_ParentProcess.joinr)	r2rurvr<rLrxrUr3rTr	r	r	r
rfls


rfc@seZdZdd�Zdd�ZdS)�_MainProcesscCs8d|_d|_d|_d|_d|_tt�d��dd�|_dS)Nr	ZMainProcessF� z/mp)rQZ	semprefix)	r#r4r(rr+rRr&�urandomr$rr	r	r
r<�s�z_MainProcess.__init__cCsdSrr	rr	r	r
rM�rz_MainProcess.closeN)r2rurvr<rMr	r	r	r
r��sr�r_�ZSIG�_r)$�__all__r&rl�signalrdrgZ_weakrefsetr�path�abspath�getcwdZORIGINAL_DIR�OSErrorrrrr�objectrr}rRrfr�rrr;r"rerr\r
�__dict__�itemsr)Zsignumr5r	r	r	r
�<module>sB	�

!
�


?>