auto ! ˆl–ß=¿JJj"Tâ€jã,Üiå1hß 0ÁÅÄ# ˆl–äY>” je¶…8 Cq§nµ1hßà ƒy—CÂÆÅ ³ a ´in/ã@súddlZddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddl m Z ddl mZddl mZddl mZgd ¢Zd Ze d ¡ZGd d „d eƒZddd„Zdd„Zdd„Zdd„ZeƒZejZejZejZejZdS)éNé)Ú connection)Úprocess)Ú reduction)Úresource_tracker)Úspawn)Úutil)Úensure_runningÚget_inherited_fdsÚconnect_to_new_processÚset_forkserver_preloadéÚqc@sDeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dS)Ú ForkServercCs.d|_d|_d|_d|_t ¡|_dg|_dS)NÚ__main__)Ú_forkserver_addressÚ_forkserver_alive_fdÚ_forkserver_pidÚ_inherited_fdsÚ threadingÚLockÚ_lockÚ_preload_modules©Úself©rú2/usr/lib64/python3.9/multiprocessing/forkserver.pyÚ__init__"s  zForkServer.__init__cCs2|j�| ¡Wdƒn1s$0YdS©N)rÚ_stop_unlockedrrrrÚ_stop*szForkServer._stopcCsV|jdurdSt |j¡d|_t |jd¡d|_t |j¡sLt |j¡d|_dS)Nr) rÚosÚcloserÚwaitpidrÚis_abstract_socket_namespacerÚunlinkrrrrr/s    zForkServer._stop_unlockedcCs&tdd„|jDƒƒstdƒ‚||_dS)z>Set list of module names to try to load in forkserver process.css|]}t|ƒtuVqdSr)ÚtypeÚstr)Ú.0ÚmodrrrÚ @óz4ForkServer.set_forkserver_preload..z&module_names must be a list of stringsN)ÚallrÚ TypeError)rZ modules_namesrrrr >sz!ForkServer.set_forkserver_preloadcCs|jS)z”Return list of fds inherited from parent process. This returns None if the current process was not started by fork server. )rrrrrr DszForkServer.get_inherited_fdsc Cs| ¡t|ƒdtkr tdƒ‚t tj¡�Ü}| |j¡t  ¡\}}t  ¡\}}|||j t   ¡g}||7}zvz:t  ||¡||fWWt |¡t |¡WdƒSt |¡t |¡‚Yn0Wt |¡t |¡nt |¡t |¡0Wdƒn1�s0YdS)a;Request forkserver to create a child process. Returns a pair of fds (status_r, data_w). The calling process can read the child process's pid and (eventually) its returncode from status_r. The calling process should write to data_w the pickled preparation and process data. éz too many fdsN)r ÚlenÚMAXFDS_TO_SENDÚ ValueErrorÚsocketÚAF_UNIXÚconnectrr!ÚpiperrZgetfdrÚsendfdsr")rÚfdsÚclientÚparent_rÚchild_wÚchild_rÚparent_wZallfdsrrrr Ls2   ÿ    ù     ÿ z!ForkServer.connect_to_new_processc sÈ|j��ªt ¡|jdurbt |jtj¡\}}|sDWdƒdSt |j¡d|_ d|_d|_d}|j r–ddh‰t   d¡}‡fdd„|  ¡Dƒ}ni}t tj¡�ì}t d¡}| |¡t |¡sÒt |d ¡| ¡t ¡\}}z~zV| ¡|g} || ¡||j |f;}t  ¡} | gt ¡} | d |g7} t | | | ¡}Wnt |¡‚Yn0Wt |¡n t |¡0||_ ||_||_Wdƒn1�sš0YWdƒn1�sº0YdS) zíMake sure that a fork server is running. This can be called from any process. Note that usually a child process will just reuse the forkserver started by its parent, so ensure_running() will do nothing. NzCfrom multiprocessing.forkserver import main; main(%d, %d, %r, **%r)Ú main_pathÚsys_pathÚignorecsi|]\}}|ˆvr||“qSrr)r(ÚxÚy©Z desired_keysrrÚ „