��Qc@sddlZddlZddlZddlZddlmZmZddddddgZd �Zdd
l m
Z
de
fd��YZd�Zej
eej�e�d
�Zej
eej�e�ej
eej�e�yddlmZWnek
rn#Xd�Zd�Zej
ee�ejdkr�ddlZejZejZej Z de!fd��YZ"n}ddl#Z#ddl$Z$ddl%Z%ddlZddl&m'Z'm(Z(m)Z)ddlm*Z*ddl m+Z+m,Z,dd�Z.dZ/ejdko%e0ede1�Z2ej3j4�j5d�Z6e'j7Ze'j8Z e6rsej9j:ej;d�a<n ej3a<d�Z=de1d�Zde!fd��YZ"d�Z>d �Z?d!�Z@d"�ZAd#�ZBd$�ZCej
e(eC�ej
e)eC�gZDd%�ZEdS(&i�N(tutiltprocesstPopentassert_spawningtexitt duplicatetclosetForkingPicklercCs,tj�s(tdt|�j��ndS(NsF%s objects should only be shared between processes through inheritance(Rtthread_is_spawningtRuntimeErrorttypet__name__(tself((s-/sys/lib/python2.7/multiprocessing/forking.pyR0s(tPicklercBs&eZejj�Zed��ZRS(cs �fd�}||j|<dS(Ncs#�|�}|jd||�dS(Ntobj(tsave_reduce(RRtrv(treduce(s-/sys/lib/python2.7/multiprocessing/forking.pyt
dispatcherAs(tdispatch(tclsR
RR((Rs-/sys/lib/python2.7/multiprocessing/forking.pytregister?s(Rt
__module__R
RtcopytclassmethodR(((s-/sys/lib/python2.7/multiprocessing/forking.pyR<scCsE|jdkr(t|j|jjffSt|j|jjffSdS(N(tim_selftNonetgetattrtim_classtim_funct func_name(tm((s-/sys/lib/python2.7/multiprocessing/forking.pyt_reduce_methodFscCst|j|jffS(N(Rt__objclass__R(R((s-/sys/lib/python2.7/multiprocessing/forking.pyt_reduce_method_descriptorMs(tpartialcCs"t|j|j|jpiffS(N(t_rebuild_partialtfunctargstkeywords(tp((s-/sys/lib/python2.7/multiprocessing/forking.pyt_reduce_partial\scCst|||�S(N(R#(R%R&R'((s-/sys/lib/python2.7/multiprocessing/forking.pyR$^stwin32cBsDeZd�Zejd�Zdd�Zd�Ze d��Z
RS(cCs�tjj�tjj�d|_tj�|_|jdkr�dtj kriddl
}|j�n|j�}tjj�tjj�tj
|�ndS(Nitrandomi�(tsyststdouttflushtstderrRt
returncodetostforktpidtmodulesR+tseedt
_bootstrapt_exit(Rtprocess_objR+tcode((s-/sys/lib/python2.7/multiprocessing/forking.pyt__init__ts
cCs�|jdkr�x\trmytj|j|�\}}Wn/tjk
rh}|jtjkrdqndSXPqW||jkr�tj |�r�tj
|�|_q�tj|�s�t�tj
|�|_q�n|jS(N(R0RtTrueR1twaitpidR3terrorterrnotEINTRtWIFSIGNALEDtWTERMSIGt WIFEXITEDtAssertionErrortWEXITSTATUS(RtflagR3tstste((s-/sys/lib/python2.7/multiprocessing/forking.pytpoll�s cCs�|dkr|jd�Stj�|}d}xb|j�}|dk rNPn|tj�}|dkrnPnt|d|d�}tj|�q2|S(Nig�Mb@?ig����(RRHttimetmintsleep(Rttimeouttdeadlinetdelaytrest remaining((s-/sys/lib/python2.7/multiprocessing/forking.pytwait�s
cCsd|jdkr`ytj|jtj�Wq`tk
r\}|jdd�dkr]�q]q`XndS(NRLg����( R0RR1tkillR3tsignaltSIGTERMtOSErrorRQ(RRG((s-/sys/lib/python2.7/multiprocessing/forking.pyt terminate�scCstS(N(tFalse(((s-/sys/lib/python2.7/multiprocessing/forking.pyR�sN(RRR:R1tWNOHANGRHRRQRVtstaticmethodR(((s-/sys/lib/python2.7/multiprocessing/forking.pyRrs
(R*t
ConnectiontPipeConnectioni(tFinalize(tloadtHIGHEST_PROTOCOLcCst||�j|�dS(N(Rtdump(Rtfiletprotocol((s-/sys/lib/python2.7/multiprocessing/forking.pyR_�sitfrozenspythonservice.exes
python.execCs
|adS(N(t_python_exe(texe((s-/sys/lib/python2.7/multiprocessing/forking.pytset_executable�scCsF|dkrtj�}ntjtj�||d|tj�j�S(Ni(Rt_subprocesstGetCurrentProcesstDuplicateHandletDUPLICATE_SAME_ACCESStDetach(thandlettarget_processtinheritable((s-/sys/lib/python2.7/multiprocessing/forking.pyR�s
cBs_eZdZej�Zd�Zed��Zed��Z dd�Zd�Zd�Z
RS(sH
Start a subprocess to run the code of a process object
c
Cs7tj�\}}ttj|�dt�}tj|�t�|g}djd�|D��}t j
t|ddddddd�\}}}} |j
�t|�||_d|_||_t|j�}
tj|d�}t|�tj_z$t|
|t�t||t�Wdtj`|j�XdS(NRmt css|]}d|VqdS(s"%s"N((t.0tx((s-/sys/lib/python2.7/multiprocessing/forking.pys <genexpr>siitwb(R1tpipeRtmsvcrtt
get_osfhandleR;Rtget_command_linetjoinRft
CreateProcessRcRtCloseR3R0t_handletget_preparation_datat_nametfdopentintRt_tlstprocess_handleR_R^(RR8trfdtwfdtrhandletcmdthpthtR3ttidt prep_datatto_child((s-/sys/lib/python2.7/multiprocessing/forking.pyR:�s(
-
cCsttjdd�dk S(NR(RRR~R(((s-/sys/lib/python2.7/multiprocessing/forking.pyRscCst|tjj�S(N(RRR~R(Rk((s-/sys/lib/python2.7/multiprocessing/forking.pytduplicate_for_childscCs�|jdkr�|dkr'tj}ntdt|dd��}tjt|j�|�}|tjkr�tj |j�}|t
kr�tj}n||_q�n|jS(Nii�g�
R0RRftINFINITEtmaxR}tWaitForSingleObjectRyt
WAIT_OBJECT_0tGetExitCodeProcesst TERMINATERSRT(RRLtmsecsROR9((s-/sys/lib/python2.7/multiprocessing/forking.pyRQ"s
cCs|jdd�S(NRLi(RQ(R((s-/sys/lib/python2.7/multiprocessing/forking.pyRH2scCse|jdkraytjt|j�t�Wqatk
r]|jdd�dkr^�q^qaXndS(NRLg����( R0RRftTerminateProcessR}RyR�tWindowsErrorRQ(R((s-/sys/lib/python2.7/multiprocessing/forking.pyRV5s
N(RRt__doc__tthreadt_localR~R:RYRR�RRQRHRV(((s-/sys/lib/python2.7/multiprocessing/forking.pyR�s ! cCsFt|�dkr>|ddkr>t|�dks:t�tStSdS(sE
Return whether commandline indicates we are forking
iis--multiprocessing-forkiN(tlenRCR;RW(targv((s-/sys/lib/python2.7/multiprocessing/forking.pyt
is_forkingAs"cCs'ttj�r#t�tj�ndS(sM
Run code for process object if this in not the main process
N(R�R,R�tmainR(((s-/sys/lib/python2.7/multiprocessing/forking.pytfreeze_supportLscCstttj�dt�r'td��nttdt�rFtjdgSd}tj�}t g|d|dgSdS(sR
Returns prefix of command line used for spawning a child process
t_inheritings�
Attempt to start a new process before the current process
has finished its bootstrapping phase.
This probably means that you are on Windows and you have
forgotten to use the proper idiom in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce a Windows executable.Rbs--multiprocessing-forks0from multiprocessing.forking import main; main()s-cN(
RRtcurrent_processRWR R,t
executableRt_args_from_interpreter_flagsRc(tprogtopts((s-/sys/lib/python2.7/multiprocessing/forking.pyRuUs
cCs�ttj�st�ttjd�}tj|tj�}tj |d�}t
tj�_
t|�}t|�t|�}ttj�_
|j�|j�}t|�dS(s>
Run code specifed by data received over pipe
i�trbN(R�R,R�RCR}Rstopen_osfhandleR1tO_RDONLYR|R;RR�R�R]tprepareRWRR6R(Rktfdtfrom_parenttpreparation_dataRtexitcode((s-/sys/lib/python2.7/multiprocessing/forking.pyR�ps
c
Cs.ddlm}m}td|dtjdtjd|dtjdtj �j
�}|dk rt|j�|d <nt
r*tr*ttjd
dd�}|r�tjddkr�tjd}n|dk r*tjj|�rtjdk rtjjtj|�}ntjj|�|d<q*n|S(sU
Return info about parent needed by child to unpickle process object
i(t_loggert_log_to_stderrtnametsys_pathtsys_argvt
log_to_stderrtorig_dirtauthkeyt log_levelt__main__t__file__its-ct main_pathN(R�s-c(RR�R�tdictR,tpathR�RtORIGINAL_DIRR�R�RtgetEffectiveLeveltWINEXEt
WINSERVICERR4R1tisabsRvtnormpath(R�R�R�tdR�((s-/sys/lib/python2.7/multiprocessing/forking.pyRz�s( cCsVtj�s(tdt|�j��nt|�tj|j��|j|jffS(NsLBy default %s objects can only be shared between processes
using inheritance( RRR R
RR�tfilenotreadabletwritable(tconn((s-/sys/lib/python2.7/multiprocessing/forking.pytreduce_connection�sc
Cs�tjtjd�d|kr6|dtj�_nd|krX|dtj�_nd|kr{|dr{tj �nd|kr�tj
�j|d�nd|kr�|dt_nd|kr�|dt_
nd|kr�j|d�nd |kr|d t_nd
|kr�|d
}tjjtjj|��d}|dkrztjjtjj|��}n|d
kr�ddl}|dkr�d}nTtjj|�jd�r�jjtjj|��g}ntjj|�g}|tjkst|��|j||�\}}}z|jd|||�}Wd|rc|j�nX|tjd<d|_xM|jj�D]9} y| jdkr�d| _nWq�tk
r�q�Xq�Wq�ndS(sE
Try to get current process ready to unpickle process object
R�R�R�R�R�R�R�tdirR�R�iR:tipythoni�Ns__init__.pyt__parents_main__( told_main_modulestappendR,R4RR�R�t_authkeyRR�t
get_loggertsetLevelR�R�R1tchdirR�tsplitexttbasenametdirnametimpRt
startswithRCtfind_moduletload_moduleRRt__dict__tvaluesRt Exception(
tdataR�t main_nameR�tdirsR`t path_nametetctmain_moduleR((s-/sys/lib/python2.7/multiprocessing/forking.pyR��sX
"! $
(FR1R,RSR>tmultiprocessingRRt__all__RtpickleR
RR RR
tsaveR"tlistR�R}t__add__t functoolsR#tImportErrorR)R$tplatformRIR7RtdupRRtobjectRR�RsRft_multiprocessingR*RZR[R\R]R^RR_R�RRWR�R�tlowertendswithR�tExitProcesstCloseHandleR�Rvtexec_prefixRcReR�R�RuR�RzR�R�R�(((s-/sys/lib/python2.7/multiprocessing/forking.pyt<module>#sn
G!
N "
|