�`^c@s2dddgZddlZddlZddlZddlZyejjej��ZWne k
rtdZnXd�Zd�Zd�Z
defd��YZd efd
��YZdefd��YZe�a[iZxGejj�D]6\ZZed
dkr�ekr�ee<q�WdS(tProcesstcurrent_processtactive_childreni�NcCstS(s@
Return process object representing the current process
(t_current_process(((s-/sys/lib/python2.7/multiprocessing/process.pyR;scCst�ttj�S(sN
Return list of process objects corresponding to live child processes
(t_cleanuptlistRt _children(((s-/sys/lib/python2.7/multiprocessing/process.pyRAscCsFx?ttj�D].}|jj�dk rtjj|�qqWdS(N(RRRt_popentpolltNonetdiscard(tp((s-/sys/lib/python2.7/multiprocessing/process.pyRLscBs�eZdZdZddddid�Zd�Zd�Zd�Zdd�Z d�Z
ed��Zej
d��Zed ��Zej
d
��Zed��Zej
d��Zed
��Zed��ZeZd�Zd�ZRS(s�
Process objects represent activity that is run in a separate process
The class is analagous to `threading.Thread`
cCs�|dkstd��tjj�}tj|f|_tj|_tj|_tj|_t j
�|_d|_||_
t|�|_t|�|_|p�t|�jddjd�|jD��|_dS(Ns#group argument must be None for nowt-t:css|]}t|�VqdS(N(tstr(t.0ti((s-/sys/lib/python2.7/multiprocessing/process.pys <genexpr>ks(R tAssertionErrorRt_countertnextt _identityt_authkeyt _daemonict_tempdirtostgetpidt_parent_pidRt_targetttuplet_argstdictt_kwargsttypet__name__tjoint_name(tselftgroupttargettnametargstkwargstcount((s-/sys/lib/python2.7/multiprocessing/process.pyt__init__^s cCs&|jr"|j|j|j�ndS(sQ
Method to be run in sub-process; can be overridden in sub-class
N(RRR(R$((s-/sys/lib/python2.7/multiprocessing/process.pytrunms cCs�|jdkstd��|jtj�ks<td��tjsRtd��t�|j dk rt|j }nddl
m}||�|_tjj
|�dS(s%
Start child process
scannot start a process twices:can only start a process object created by current processs3daemonic processes are not allowed to have childreni(tPopenN(RR RRRRRRRt_PopentforkingR-Rtadd(R$R-((s-/sys/lib/python2.7/multiprocessing/process.pytstartts
cCs|jj�dS(sT
Terminate process; sends SIGTERM signal or uses TerminateProcess()
N(Rt terminate(R$((s-/sys/lib/python2.7/multiprocessing/process.pyR2�scCsq|jtj�ks!td��|jdk s<td��|jj|�}|dk rmtjj |�ndS(s5
Wait until child process terminates
scan only join a child processscan only join a started processN(
RRRRRR twaitRRR
(R$ttimeouttres((s-/sys/lib/python2.7/multiprocessing/process.pyR"�s
!cCsa|tkrtS|jtj�ks1td��|jdkrDtS|jj �|jj
dkS(s1
Return whether process is alive
scan only test a child processN(RtTrueRRRRRR tFalseRt
returncode(R$((s-/sys/lib/python2.7/multiprocessing/process.pytis_alive�s!
cCs|jS(N(R#(R$((s-/sys/lib/python2.7/multiprocessing/process.pyR'�scCs(t|t�std��||_dS(Nsname must be a string(t
isinstancet
basestringRR#(R$R'((s-/sys/lib/python2.7/multiprocessing/process.pyR'�scCs|jS(s4
Return whether process is a daemon
(R(R$((s-/sys/lib/python2.7/multiprocessing/process.pytdaemon�scCs(|jdkstd��||_dS(s1
Set whether process is a daemon
sprocess has already startedN(RR RR(R$tdaemonic((s-/sys/lib/python2.7/multiprocessing/process.pyR<�scCs|jS(N(R(R$((s-/sys/lib/python2.7/multiprocessing/process.pytauthkey�scCst|�|_dS(s2
Set authorization key of process
N(tAuthenticationStringR(R$R>((s-/sys/lib/python2.7/multiprocessing/process.pyR>�scCs#|jdkr|jS|jj�S(sM
Return exit code of process or `None` if it has yet to stop
N(RR R(R$((s-/sys/lib/python2.7/multiprocessing/process.pytexitcode�scCs-|tkrtj�S|jo(|jjSdS(sU
Return identifier (PID) of process or `None` if it has yet to start
N(RRRRtpid(R$((s-/sys/lib/python2.7/multiprocessing/process.pytident�s
cCs�|tkrd}n]|jtj�kr3d}n?|jdkrKd}n'|jj�dk rl|j}nd}t|�t kr�|dkr�d}q�dt
j||�}ndt|�j|j
||jr�dp�d fS(
Ntstartedtunknowntinitialitstoppedsstopped[%s]s<%s(%s, %s%s)>s daemont(RRRRRR RR@R tintt_exitcode_to_nametgetR!R#R(R$tstatus((s-/sys/lib/python2.7/multiprocessing/process.pyt__repr__�s cCs�ddlm}y�t�|_tjd�|_y#tjj �t
tj�t_Wnt
tfk
rmnX|a|jj�|j�|jd�z|j�d}Wd|j�XWn�tk
r<}|js�d}q�t|jdt�r|jd}q�tjjt|jd�d�tjj�d}nGd}ddl}tjjd|j�tjj�|j �nX|jd|�|S( Ni(tutils child process calling self.run()is
i�sProcess %s:
s process exiting with exitcode %d(!RGRMtsetRt itertoolsR*RtsyststdintclosetopenRtdevnulltOSErrort
ValueErrorRt_finalizer_registrytcleart_run_after_forkerstinfoR,t_exit_functiont
SystemExitR(R:RHtstderrtwriteRtflusht tracebackR't print_exc(R$RMR@teR`((s-/sys/lib/python2.7/multiprocessing/process.pyt
_bootstrap�sB
!
N((R!t
__module__t__doc__R R.R+R,R1R2R"R9tpropertyR'tsetterR<R>R@RBRARLRc(((s-/sys/lib/python2.7/multiprocessing/process.pyRVs&
R?cBseZd�ZRS(cCs>ddlm}|j�s+td��ntt|�ffS(Ni(R-sJPickling an AuthenticationString object is disallowed for security reasons(R/R-tthread_is_spawningt TypeErrorR?tbytes(R$R-((s-/sys/lib/python2.7/multiprocessing/process.pyt
__reduce__s
(R!RdRk(((s-/sys/lib/python2.7/multiprocessing/process.pyR?st_MainProcesscBseZd�ZRS(cCspd|_t|_d|_d|_d|_tjd�|_ t
�|_tt
jd��|_d|_dS(NtMainProcessii ((RR7RR#R RRROR*RRNRR?RturandomRR(R$((s-/sys/lib/python2.7/multiprocessing/process.pyR+-s (R!RdR+(((s-/sys/lib/python2.7/multiprocessing/process.pyRl+sitSIGt_(t__all__RRPtsignalROtpathtabspathtgetcwdtORIGINAL_DIRRUR RRRtobjectRRjR?RlRRIt__dict__titemsR'tsignum(((s-/sys/lib/python2.7/multiprocessing/process.pyt<module>#s(
�
|