VcJ/&gdZddlZddlZddlZddlZddlZddlmZ ej ej Z n #e $rdZ YnwxYwdZ dZdZdZGdd eZGd d eZGd d eZGddeZdaeaejdaea[iZeej D] \Z!Z"e!dddkr de!vr de!ee" <![!["eZ#dS)) BaseProcesscurrent_processactive_childrenparent_processN)WeakSetctS)z@ Return process object representing the current process )_current_process0/usr/lib64/python3.11/multiprocessing/process.pyrr%s  r cFtttS)zN Return list of process objects corresponding to live child processes )_cleanuplist _childrenr r r rr+s JJJ  ??r ctS)z? Return process object representing the parent process )_parent_processr r r rr3s  r cttD]5}|jt|6dSN)rr_popenpolldiscard)ps r rr=sH )__!! 8==?? !   a !!r cneZdZdZdZddddifdddZdZdZd Zd Z d Z dd Z d Z dZ edZejdZedZejdZedZejdZedZedZeZedZdZddZedZdS)rz Process objects represent activity that is run in a separate process The class is analogous to `threading.Thread` ctr)NotImplementedErrorselfs r _PopenzBaseProcess._PopenMs!!r Nr )daemonc6tt}tj|fz|_tj|_t j|_tj |_ d|_ d|_ ||_ t||_t!||_|p;t%|jdzdd|jDz|_|||_t.|dS)NF-:c34K|]}t|VdSr)str).0is r z'BaseProcess.__init__..^s(==c!ff======r )next_process_counterr _identity_configcopyosgetpid _parent_pidname _parent_namer_closed_targettuple_argsdict_kwargstype__name__join_namer _danglingadd)rgrouptargetr0argskwargsrcounts r __init__zBaseProcess.__init__Ps%&&)3uh>'/4466 9;;,1   4[[ F|| >T$ZZ036XX==dn=====>  ! DK dr c2|jrtddS)Nzprocess object is closed)r2 ValueErrorrs r _check_closedzBaseProcess._check_closedcs% < 9788 8 9 9r cF|jr|j|ji|jdSdS)zQ Method to be run in sub-process; can be overridden in sub-class N)r3r5r7rs r runzBaseProcess.rungs9 < 6 DL$* 5 5 5 5 5 5 6 6r c|t|||_|jj|_|`|`|`t |dS)z% Start child process N) rFrrrsentinel _sentinelr3r5r7rr=rs r startzBaseProcess.startnsg   kk$'' - L$*dl dr c`||jdS)zT Terminate process; sends SIGTERM signal or uses TerminateProcess() N)rFr terminaters r rNzBaseProcess.terminates0  r c`||jdS)zT Terminate process; sends SIGKILL signal or uses TerminateProcess() N)rFrkillrs r rPzBaseProcess.kills0  r c||j|}|t|dSdS)z5 Wait until child process terminates N)rFrwaitrr)rtimeoutress r r:zBaseProcess.joinsY kw''  $   d # # # # # $ $r c||turdS|jdS|j}|dSt|dS)z1 Return whether process is alive TNF)rFr rrrr)r returncodes r is_alivezBaseProcess.is_alivess  # # 4 ; 5[%%''  4   d # # #5r c|jd|jtd|jd|_|`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)rrrEcloserKrrr2rs r rYzBaseProcess.closes ; ${!! Q "PQQQ K     DK   d # # # r c|jSrr;rs r r0zBaseProcess.names zr c||_dSrr[)rr0s r r0zBaseProcess.names r c8|jddS)z4 Return whether process is a daemon rF)r+getrs r rzBaseProcess.daemons |%000r c||jd<dS)z1 Set whether process is a daemon rNr+)rdaemonics r rzBaseProcess.daemons "* Xr c|jdS)Nauthkeyr`rs r rczBaseProcess.authkeys|I&&r c4t||jd<dS)z2 Set authorization key of process rcN)AuthenticationStringr+)rrcs r rczBaseProcess.authkeys #7w"?"? Yr cx||j|jS|jS)zM Return exit code of process or `None` if it has yet to stop )rFrrrs r exitcodezBaseProcess.exitcodes<  ; ; {!!!r c||turtjS|jo |jjS)zU Return identifier (PID) of process or `None` if it has yet to start )rFr r-r.rpidrs r identzBaseProcess.identsA  # # 39;; ;24;? 2r cv| |jS#t$rtddwxYw)z{ Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination. zprocess not startedN)rFrKAttributeErrorrErs r rJzBaseProcess.sentinelsO  >> ! > > >233 = >s8cd}|turd}nS|jrd}nI|jtjkrd}n*|jd}n |j}|d}nd}t|jd|j zg}|j"| d|jj z| d|jz| ||3t ||}| d |z|jr| d d d |zS) Nstartedclosedunknowninitialstoppedzname=%rzpid=%sz parent=%sz exitcode=%srz<%s> )r r2r/r-r.rrr8r9r;appendri_exitcode_to_namer^rr:)rrgstatusinfos r __repr__zBaseProcess.__repr__sR # # #FF \ #FF   , #FF [ #FF{''))H #""T #Y%;< ; 4 KK4;?2 3 3 3 K$"22333 F  2(,,Xx@@H KK 0 1 1 1 ; " KK ! ! !&&r cddlm}m} |j||jt jdata | t}|a t|j |j|at jr%t!j |~n#~wxYw|d |d}|n#|wxYwn#t0$rl}|jd}nXt5|jt6r|j}n6t8jt?|jdzd}Yd}~nKd}~wd}ddl }t8jd|j!z|"YnxYwt!j#|d|z|$nD#t!j#|d|z|$wxYw|S)N)utilcontextz child process calling self.run()r z Process %s: z process exiting with exitcode %d)%r{r| _start_method_force_start_method itertoolsrBr)setr _close_stdinr _ParentProcessr1r/r threading_HAVE_THREAD_NATIVE_ID main_thread_set_native_id _after_forkrwrH_exit_function SystemExitcode isinstanceintsysstderrwriter$ tracebackr0 print_exc _shutdown_flush_std_streams)rparent_sentinelr{r| old_processrgers r _bootstrapzBaseProcess._bootstrap"s########( &! @++D,>???(q11 I      *K# ,!4#3_FFO/ 9%''66888   """ KK II8 9 9 9 & ##%%%%##%%%%%   v AFC(( 6   QVt!3444 "H     J  _ty8 9 9 9    ! ! ! ! !   ! ! ! II88C D D D  # # % % % %   ! ! ! II88C D D D  # # % % % %scB,D.7C D. CD.)D?D.D**D.-H*. G'8A"FH*AG'%H**AI+clddlm}|j|dS)Nrzr{)r~r{_finalizer_registryclear_run_after_forkersrs r rzBaseProcess._after_forkRsA  &&((( !!!!!r r)r9 __module__ __qualname____doc__rrCrFrHrLrNrPr:rWrYpropertyr0setterrrcrgrjrirJrxr staticmethodrr r r rrGs """"$T2&999666$    $ $ $ $&"X [[11X1  ]**]*''X' ^@@^@ ""X"33X3 C  > >X >'''>....`""\"""r rceZdZdZdS)recnddlm}|tdtt |ffS)Nrz)get_spawning_popenzJPickling an AuthenticationString object is disallowed for security reasons)r|r TypeErrorrebytes)rrs r __reduce__zAuthenticationString.__reduce__^sQ//////     2 $eDkk^33r N)r9rrrr r r rere]s#44444r rec<eZdZdZdZedZddZeZdS)rcvd|_||_||_d|_d|_d|_||_i|_dS)Nr F)r*r;_pidr/rr2rKr+)rr0rirJs r rCz_ParentProcess.__init__ns?    ! r c6ddlm}||jgd S)NrrRrSmultiprocessing.connectionrRrK)rrRs r rWz_ParentProcess.is_alivexs13333334(!44444r c|jSr)rrs r rjz_ParentProcess.ident|s yr Nc8ddlm}||jg|dS)z6 Wait until parent process terminates rrrNr)rrSrRs r r:z_ParentProcess.joins6 433333 dn w//////r r) r9rrrCrWrrjr:rir r r rrlsb555X0000 CCCr rceZdZdZdZdS) _MainProcesscd|_d|_d|_d|_d|_t t jddd|_dS)Nr MainProcessF z/mp)rc semprefix) r*r;r/rr2rer-urandomr+rs r rCz_MainProcess.__init__sN"   #7 2#G#G%*,, r cdSrr rs r rYz_MainProcess.closes r N)r9rrrCrYr r r rrs2,,,$     r rrzSIG_r!)$__all__r-rsignalrr _weakrefsetrpathabspathgetcwd ORIGINAL_DIROSErrorrrrrobjectrrrerrrr rBr)rrrur__dict__itemsr0signumr<r r r rs@     7??929;;//LLLLL !!!O"O"O"O"O"&O"O"O"l444445444[B     ;   0<>>"9?1%% CEE  D..001100LD& BQBx03d?0%/ZZ6'"& GII s'AAA