U e5d@sBdddddgZddlZddlZddlZddlZddlZddlZddlZddlmZddl m Z d d l m Z d d l mZmZmZd d l mZd d l mZd dl mZd dl mZzd dl mZdZWnek rdZYnXddZeejedddDZedek r.ddZeD]ZeeeqGdddeZdifddZ ddZ!Gd d!d!e"Z#d"d#Z$d$d%Z%Gd&d'd'eZ&Gd(d)d)eZ'e j(e j)fe j*e j+fd*Z,Gd+ddeZ-Gd,d-d-e.Z/Gd.ddeZ0d/d0Z1ifd1d2Z2dld3d4Z3Gd5d6d6eZ4Gd7d8d8eZ5dmd9d:Z6Gd;d<dd>e0Z8Gd?d@d@e8Z9GdAdBdBe0Z:GdCdDdDe0Z;GdEdFdFe0ZGdKdLdLe>Z?e2dMdNZ@dOdPie@_Ae2dQdRZBe2dSdTZCdUdUdUdPdPdVeC_AGdWdSdSeCZDGdXdde-ZEeEdYejFeEdZejFeEd[ejGe:eEd\ejHe8eEd]ejIe8eEd^ejJe8eEd_ejKe8eEd`ejLe9eEdaejMe;eEdbejNeDeEdcee?eEddeOe@eEd8e5e=eEd:e6eBeEd6e4e<eEjdPe7ddeeEjdUddfer>GdgdhdhZPGdidjdje&ZQGdkdde-ZRdS)n BaseManager SyncManager BaseProxyTokenSharedMemoryManagerN)getpid) format_exc) connection) reductionget_spawning_popen ProcessError)pool)process)util) get_context) shared_memoryTFcCstj|j|ffSN)arraytypecodetobytes)ar0/usr/lib64/python3.8/multiprocessing/managers.py reduce_array-srcCsg|]}tti|qSr)typegetattr.0namerrr 1sr )itemskeysvaluescCstt|ffSr)listobjrrrrebuild_as_list3sr'c@s0eZdZdZddZddZddZdd Zd S) rtypeidaddressidcCs||||_|_|_dSrr()selfr)r*r+rrr__init__BszToken.__init__cCs|j|j|jfSrr(r,rrr __getstate__EszToken.__getstate__cCs|\|_|_|_dSrr(r,staterrr __setstate__HszToken.__setstate__cCsd|jj|j|j|jfS)Nz %s(typeid=%r, address=%r, id=%r)) __class____name__r)r*r+r.rrr__repr__KszToken.__repr__N)r4 __module__ __qualname__ __slots__r-r/r2r5rrrrr<s rcCs8|||||f|\}}|dkr*|St||dS)N#RETURN)sendrecvconvert_to_error)cr+ methodnameargskwdskindresultrrrdispatchSs  rCcCsd|dkr |S|dkrRt|ts4td||t||dkrHtd|St|Sntd|SdS)N#ERROR) #TRACEBACK#UNSERIALIZABLEz.Result {0!r} (kind '{1}') type is {2}, not strrFzUnserializable message: %s zUnrecognized message type {!r}) isinstancestr TypeErrorformatr RemoteError ValueError)rArBrrrr<]s   r<c@seZdZddZdS)rKcCsdt|jddS)NzM --------------------------------------------------------------------------- rzK---------------------------------------------------------------------------)rHr?r.rrr__str__mszRemoteError.__str__N)r4r6r7rMrrrrrKlsrKcCs2g}t|D] }t||}t|r ||q |Sr)dirrcallableappend)r&temprfuncrrr all_methodsts    rScCsddt|DS)NcSsg|]}|ddkr|qS)r_rrrrrr s z"public_methods..)rSr%rrrpublic_methodssrUc @seZdZddddddddd g Zd d Zd d ZddZddZddZddZ ddZ ddZ e e e dZ ddZ ddZdd Zd!d"Zd#d$Zd%e_d&d'Zd(d)Zd*d+Zd,d-Zd.S)/Servershutdowncreateaccept_connection get_methods debug_infonumber_of_objectsdummyincrefdecrefcCsxt|tstd|t|||_t||_t |\}}||dd|_ |j j |_ ddi|_ i|_ i|_t|_dS)Nz&Authkey {0!r} is type {1!s}, not bytes)r*Zbacklog0Nr)rGbytesrIrJrregistryrAuthenticationStringauthkeylistener_clientlistenerr* id_to_objid_to_refcountid_to_local_proxy_obj threadingLockmutex)r,rdr*rf serializerListenerClientrrrr-s      zServer.__init__c Cst|_|t_zVtj|jd}d|_|z|jsL|jdq4Wnttfk rfYnXW5tjtjkrt dtjt_tj t_ t dXdS)Nzresetting stdout, stderrr)targetTr )rlEvent stop_eventrcurrent_process_manager_serversysstdout __stdout__rdebug __stderr__stderrexitThreadaccepterdaemonstartis_setwaitKeyboardInterrupt SystemExit)r,rrrr serve_forevers       zServer.serve_forevercCsNz|j}Wntk r&YqYnXtj|j|fd}d|_|qdS)Nrrr?T)rhZacceptOSErrorrlr~handle_requestrr)r,r=trrrrs zServer.accepterc Cs4d}}}z>t||jt||j|}|\}}}}t||}Wntk rhdtf} Yn>Xz||f||}Wntk rdtf} Yn Xd|f} z|| Wnrtk r&} zRz|dtfWntk rYnXt d| t d|t d| W5d} ~ XYnX| dS)NrEr9zFailure to send message: %rz ... request was %r ... exception was %r) r Zdeliver_challengerfZanswer_challenger;r Exceptionrr:rinfoclose) r,r=funcnamerBrequestignorer?r@rRmsgerrrrs2    zServer.handle_requestc Cstdtj|j}|j}|j}|j szBd}}|}|\}}} } z||\}} } Wn^t k r} z@z|j |\}} } Wn&t k r}z| W5d}~XYnXW5d} ~ XYnX|| krt d|t || ft||}z|| | }Wn,tk r"}z d|f}W5d}~XYnPX| o4| |d}|rj||||\}}t||j|}d||ff}nd|f}Wnt k r|dkrdtf}nNz,|j|}|||||f| | }d|f}Wn tk rdtf}YnXYnPtk rtdtjtdYn tk r<dtf}YnXzDz ||Wn2tk r~}z|d tfW5d}~XYnXWq$tk r}z@td tjtd |td ||td W5d}~XYq$Xq$dS)Nz$starting server thread to service %rz+method %r of %r object is not in exposed=%rrD#PROXYr9rEz$got EOF -- exiting thread serving %rrrFzexception in thread serving %rz ... message was %rrr )rrzrlcurrent_threadrr;r:rirtrKeyErrorrkAttributeErrorrrrgetrXrr*rfallback_mappingEOFErrorrwr}rr)r,connr;r:rir>r&ridentr?r@exposed gettypeidkeZ second_keZfunctionresrrr)ZridentZrexposedtokenZ fallback_funcrBrrr serve_clients   (        $  zServer.serve_clientcCs|Srrr,rrr&rrrfallback_getvalue5szServer.fallback_getvaluecCst|SrrHrrrr fallback_str8szServer.fallback_strcCst|Sr)reprrrrr fallback_repr;szServer.fallback_repr)rMr5 #GETVALUEcCsdSrrr,r=rrrr]Dsz Server.dummyc Cs|jtg}t|j}||D]<}|dkr&|d||j|t|j|dddfq&d|W5QRSQRXdS)Nraz %s: refcount=%s %srK ) rnr$rjr"sortrPrHrijoin)r,r=rBr"rrrrr[Gs zServer.debug_infocCs t|jSr)lenrjrrrrr\WszServer.number_of_objectscCsLz:ztd|dWnddl}|YnXW5|jXdS)Nz!manager received shutdown messager9Nr)rtsetrrzr: traceback print_exc)r,r=rrrrrW^s zServer.shutdownc Ost|dkr|^}}}}n|s(tdnd|krDtdt|d|d}t|dkr~|^}}}ddl}|jdtdd nFd |krtdt|d|d }|^}}ddl}|jd tdd t|}|j|j|\}}}} |dkr|st|dkr t d |d} n |||} |dkr2t | }|dk rlt |t s\td |t|t|t|}dt| } td|| | t||f|j| <| |jkrd|j| <W5QRX||| | t|fS)Nz8descriptor 'create' of 'Server' object needs an argumentr)7create expected at least 2 positional arguments, got %dr rz2Passing 'typeid' as keyword argument is deprecated) stacklevelr=z-Passing 'c' as keyword argument is deprecatedz4Without callable, must have one non-keyword argumentz,Method_to_typeid {0!r}: type {1!s}, not dictz%xz&%r callable returned object with id %r)rrIpopwarningswarnDeprecationWarningtuplernrdrLrUrGdictrJrr$r+rrzrrirjr^) r?r@r,r=r)rrOrmethod_to_typeid proxytyper&rrrrrXksp                  z Server.createz$($self, c, typeid, /, *args, **kwds)cCst|j|jdS)Nr )rrir+)r,r=rrrrrZszServer.get_methodscCs"|t_|d||dS)Nr)rlrrr:r)r,r=rrrrrYs  zServer.accept_connectionc Cs|jz|j|d7<Wnhtk r}zJ||jkrrd|j|<|j||j|<|j|\}}}td|n|W5d}~XYnXW5QRXdS)Nr z&Server re-enabled tracking & INCREF %r)rnrjrrkrirrz)r,r=rrr&rrrrrr^s  z Server.increfc Cs||jkr$||jkr$td|dS|jZ|j|dkrXtd||j||j||j|d8<|j|dkr|j|=W5QRX||jkrd|j|<td||j|j|=W5QRXdS)NzServer DECREF skipping %rrz+Id {0!s} ({1!r}) has refcount {2:n}, not 1+r )NrNzdisposing of obj with id %r)rjrkrrzrnAssertionErrorrJri)r,r=rrrrr_s,     z Server.decrefN)r4r6r7publicr-rrrrrrrrr]r[r\rWrX__text_signature__rZrYr^r_rrrrrVs: "Q =rVc@seZdZdgZdZdZdZdS)Statevaluerr rN)r4r6r7r8INITIALSTARTEDSHUTDOWNrrrrrsr)pickleZ xmlrpclibc@seZdZiZeZd!ddZddZddZd"d d Z e d#d d Z ddZ d$ddZ ddZddZddZddZeddZeddZe d%dd ZdS)&rNrcCs\|dkrtj}||_t||_t|_tj|j_ ||_ t |\|_ |_ |pTt|_dSr)rrurf_addressre_authkeyr_staterr _serializerrgZ _Listener_Clientr_ctx)r,r*rfroZctxrrrr-s   zBaseManager.__init__cCsf|jjtjkrP|jjtjkr&tdn*|jjtjkr>tdntd|jjt|j |j |j |j S)NAlready started serverManager has shut downUnknown state {!r}) rrrrrr rrJrV _registryrrrr.rrr get_servers    zBaseManager.get_servercCs8t|j\}}||j|jd}t|ddtj|j_dS)Nrfr]) rgrrrrCrrrr)r,rprqrrrrconnects zBaseManager.connectrc Cs4|jjtjkrP|jjtjkr&tdn*|jjtjkr>tdntd|jj|dk rht|sht dt j dd\}}|j j t|j|j|j|j|j|||fd|_dd d |jjD}t|jd ||j_|j|||_|tj|j_tj|t|j|j|j|j|j|jfd d |_ dS)Nrrrzinitializer must be a callableF)Zduplexr:css|]}t|VqdSrr)rirrr Asz$BaseManager.start..-rr?Z exitpriority)!rrrrrr rrJrOrIr ZPiperZProcessr _run_serverrrrr_processrZ _identityr4rrrr;rFinalize_finalize_managerrrW)r, initializerinitargsreaderwriterrrrrr(sH        zBaseManager.startc Cs^ttjtj|dk r |||||||}||j|td|j| dS)Nzmanager serving at %r) signalSIGINTSIG_IGN_Serverr:r*rrrr) clsrdr*rfrorrrserverrrrrSs zBaseManager._run_servercOsN|j|j|jd}zt|dd|f||\}}W5|Xt||j||fS)NrrX)rrrrrCr)r,r)r?r@rr+rrrr_createjs  zBaseManager._createcCs*|jdk r&|j||js&d|_dSr)rris_aliver,timeoutrrrrvs   zBaseManager.joincCs2|j|j|jd}zt|ddWS|XdS)Nrr[rrrrrCr,rrrr _debug_infoszBaseManager._debug_infocCs2|j|j|jd}zt|ddWS|XdS)Nrr\rrrrr_number_of_objectsszBaseManager._number_of_objectscCsj|jjtjkr||jjtjkrf|jjtjkr.temp) __dict__rcopy AutoProxyrr$r!r4setattr) rr)rOrrr create_methodkeyrrQrrrregisters(     zBaseManager.register)NNrN)Nr)Nr)N)NNNNT)r4r6r7rrVrr-rrr classmethodrrrrrrr staticmethodrpropertyr*rrrrrrs6  +       c@seZdZddZddZdS)ProcessLocalSetcCst|dddS)NcSs|Sr)clearr%rrrz*ProcessLocalSet.__init__..)rregister_after_forkr.rrrr-szProcessLocalSet.__init__cCs t|dfSrb)rr.rrr __reduce__szProcessLocalSet.__reduce__N)r4r6r7r-r rrrrrsrc@s|eZdZiZeZdddZddZdifd d Z d d Z d dZ e ddZ ddZddZddZddZddZdS)rNTFc Cstj8tj|jd}|dkr:ttf}|tj|j<W5QRX|d|_|d|_ ||_ |j j |_ ||_ ||_t|d|_||_|dk rt||_n"|j dk r|j j|_n tj|_|r|t|tjdS)Nrr )r_mutexrrr*rZForkAwareLocalr_tls_idset_tokenr+_id_managerrrgr_owned_by_managerrrerrurf_increfr  _after_fork) r,rrorrfrr^ manager_ownedZ tls_idsetrrrr-s*      zBaseProxy.__init__cCsdtdtj}tjdkr4|dtj7}|j|jj |j d}t |dd|f||j _ dS)Nzmaking connection to managerZ MainThread|rrY)rrzrrurrlrrrr*rrCrr )r,rrrrr_connect-s  zBaseProxy._connectrc Csz |jj}Wn6tk rBtdtj||jj}YnX| |j |||f| \}}|dkrp|S|dkr|\}}|j j |jd} |jj|_| ||j|j |j|d} |j|j|jd}t|dd|jf| St||dS)Nz#thread %r does not own a connectionr9rrrr_)rr rrrzrlrrrr:rr;rrr)rr*rrrrCr+r<) r,r>r?r@rrArBrrrrrrr _callmethod6s6   zBaseProxy._callmethodcCs |dS)Nrrr.rrr _getvalueTszBaseProxy._getvaluec Cs|jrtd|jjdS|j|jj|jd}t|dd|j ftd|jj|j |j |j oj|j j }tj|tj|j|j||j|j |jfdd|_dS)Nz%owned_by_manager skipped INCREF of %rrr^z INCREF %r r)rrrzrr+rr*rrCrraddrrrr_decrefrZ_close)r,rr1rrrrZs$ zBaseProxy._increfc Cs||j|dks |jtjkrz2td|j||j|d}t|dd|jfWqt k r}ztd|W5d}~XYqXntd|j|st |drtdt j |j|`dS)Nz DECREF %rrr_z... decref failed %sz%DECREF %r -- manager already shutdownr z-thread %r has no more proxies so closing conn)discardr+rrrrrzr*rCrrrlrrr r)rrfr1ZtlsZidsetrrrrrrr ns   zBaseProxy._decrefc CsHd|_z |Wn0tk rB}ztd|W5d}~XYnXdS)Nzincref failed: %s)rrrrr)r,rrrrrs  zBaseProxy._after_forkcCs^i}tdk r|j|d<t|ddrB|j|d<tt|j|j|ffStt||j|j|ffSdS)Nrf_isautoFr) r rrr RebuildProxyrrrrr,r@rrrr s    zBaseProxy.__reduce__cCs|Sr)r)r,Zmemorrr __deepcopy__szBaseProxy.__deepcopy__cCsdt|j|jjt|fS)Nz<%s object, typeid %r at %#x>)rr4rr)r+r.rrrr5szBaseProxy.__repr__cCs:z |dWStk r4t|dddYSXdS)Nr5rz; '__str__()' failed>)rrrr.rrrrMs zBaseProxy.__str__)NNNTF)r4r6r7rrZForkAwareThreadLockrr-rrrrrr rr r%r5rMrrrrrs& )   cCsttdd}|rT|j|jkrTtd|d|d<|j|jkrT|j|j|j|j<| ddopttdd }|||fd|i|S)Nrvz*Rebuild a proxy owned by manager, token=%rTrr^Z _inheritingF) rrrur*rrzr+rkrir)rRrror@rr^rrrr#s    r#cCspt|}z|||fWStk r*YnXi}|D]}td||f|q4t|tf|}||_||||f<|S)NzOdef %s(self, /, *args, **kwds): return self._callmethod(%r, args, kwds))rrexecrrr)rr_cacheZdicZmeth ProxyTyperrr MakeProxyTypes  r)c Cst|d}|dkrB||j|d}zt|dd|f}W5|X|dkrX|dk rX|j}|dkrjtj}td|j |}||||||d} d| _ | S)Nr rrZz AutoProxy[%s])rrfr^T) rgr*rrCrrrurfr)r)r") rrorrfrr^rrr(rrrrrs     rc@seZdZddZddZdS) NamespacecKs|j|dSr)rupdater$rrrr-szNamespace.__init__cCsZt|j}g}|D]$\}}|ds|d||fq|d|jjd|fS)NrTz%s=%rz%s(%s)z, ) r$rr! startswithrPrr3r4r)r,r!rQrrrrrr5s  zNamespace.__repr__N)r4r6r7r-r5rrrrr*sr*c@s8eZdZd ddZddZddZdd ZeeeZd S) ValueTcCs||_||_dSr) _typecode_value)r,rrlockrrrr-szValue.__init__cCs|jSrr/r.rrrrsz Value.getcCs ||_dSrr1r,rrrrr sz Value.setcCsdt|j|j|jfS)Nz %s(%r, %r))rr4r.r/r.rrrr5 szValue.__repr__N)T) r4r6r7r-rrr5rrrrrrr-s  r-cCs t||Sr)r)rsequencer0rrrArraysr4c@s8eZdZdZddZddZddZdd Zd d Zd S) IteratorProxy)__next__r:throwrcCs|Srrr.rrr__iter__szIteratorProxy.__iter__cGs |d|S)Nr6rr,r?rrrr6szIteratorProxy.__next__cGs |d|S)Nr:rr9rrrr:szIteratorProxy.sendcGs |d|S)Nr7rr9rrrr7szIteratorProxy.throwcGs |d|S)Nrrr9rrrr!szIteratorProxy.closeN) r4r6r7rr8r6r:r7rrrrrr5s r5c@s2eZdZdZd ddZddZdd Zd d ZdS) AcquirerProxy)acquirereleaseTNcCs"|dkr|fn||f}|d|SNr;r)r,Zblockingrr?rrrr;'szAcquirerProxy.acquirecCs |dSNr<rr.rrrr<*szAcquirerProxy.releasecCs |dSr=rr.rrrr,szAcquirerProxy.__enter__cCs |dSr>rrrrrr.szAcquirerProxy.__exit__)TN)r4r6r7rr;r<rrrrrrr:%s  r:c@s6eZdZdZd ddZd ddZdd Zdd d ZdS)ConditionProxy)r;r<rnotify notify_allNcCs|d|fSNrrrrrrr4szConditionProxy.waitr cCs|d|fS)Nr@r)r,nrrrr@6szConditionProxy.notifycCs |dS)NrArr.rrrrA8szConditionProxy.notify_allcCsd|}|r|S|dk r$t|}nd}d}|s`|dk rN|t}|dkrNq`|||}q,|S)Nr)time monotonicr)r,Z predicaterrBZendtimeZwaittimerrrwait_for:s  zConditionProxy.wait_for)N)r )N)r4r6r7rrr@rArFrrrrr?2s   r?c@s2eZdZdZddZddZddZd d d ZdS) EventProxy)rrr rcCs |dS)Nrrr.rrrrOszEventProxy.is_setcCs |dSNrrr.rrrrQszEventProxy.setcCs |dS)Nr rr.rrrr SszEventProxy.clearNcCs|d|fSrBrrrrrrUszEventProxy.wait)N)r4r6r7rrrr rrrrrrGMs rGc@sNeZdZdZdddZddZddZed d Zed d Z ed dZ dS) BarrierProxy)__getattribute__rabortresetNcCs|d|fSrBrrrrrr[szBarrierProxy.waitcCs |dS)NrKrr.rrrrK]szBarrierProxy.abortcCs |dS)NrLrr.rrrrL_szBarrierProxy.resetcCs |ddS)NrJ)partiesrr.rrrrMaszBarrierProxy.partiescCs |ddS)NrJ) n_waitingrr.rrrrNdszBarrierProxy.n_waitingcCs |ddS)NrJ)brokenrr.rrrrOgszBarrierProxy.broken)N) r4r6r7rrrKrLrrMrNrOrrrrrIYs   rIc@s(eZdZdZddZddZddZdS) NamespaceProxy)rJ __setattr__ __delattr__cCs0|ddkrt||St|d}|d|fS)NrrTrrJ)objectrJr,r callmethodrrr __getattr__ns   zNamespaceProxy.__getattr__cCs4|ddkrt|||St|d}|d||fS)NrrTrrQ)rSrQrJ)r,rrrUrrrrQss  zNamespaceProxy.__setattr__cCs0|ddkrt||St|d}|d|fS)NrrTrrR)rSrRrJrTrrrrRxs   zNamespaceProxy.__delattr__N)r4r6r7rrVrQrRrrrrrPlsrPc@s*eZdZdZddZddZeeeZdS) ValueProxy)rrcCs |dS)Nrrr.rrrrszValueProxy.getcCs|d|fSrHrr2rrrrszValueProxy.setN)r4r6r7rrrrrrrrrrWsrW BaseListProxy)__add__ __contains__ __delitem__ __getitem____len____mul__ __reversed____rmul__ __setitem__rPcountextendindexinsertrremovereverser__imul__c@seZdZddZddZdS) ListProxycCs|d|f|S)Nrcrr2rrr__iadd__szListProxy.__iadd__cCs|d|f|S)Nrhrr2rrrrhszListProxy.__imul__N)r4r6r7rjrhrrrrrisri DictProxy)rZr[r\r8r]rar rrr!r"rpopitem setdefaultr+r#r8Iterator ArrayProxy)r]r\ra PoolProxy) Zapply apply_asyncrimapimap_unorderedrmap map_asyncstarmap starmap_asyncrZ AsyncResult)rqrurwrrrsc@seZdZddZddZdS)rpcCs|Srrr.rrrrszPoolProxy.__enter__cCs |dSr)rrrrrrszPoolProxy.__exit__N)r4r6r7rrrrrrrpsc@s eZdZdS)rN)r4r6r7rrrrrsQueueZ JoinableQueuersrmRLock SemaphoreBoundedSemaphore ConditionBarrierPoolr$r)rr)rc@sHeZdZgfddZddZddZddZd d Zd d Zd dZ dS)_SharedMemoryTrackercCs||_||_dSrZshared_memory_context_name segment_names)r,rrrrrr-sz_SharedMemoryTracker.__init__cCs(td|dt|j|dS)NzRegister segment  in pid )rrzrrrPr, segment_namerrrregister_segmentsz%_SharedMemoryTracker.register_segmentcCsBtd|dt|j|t|}||dS)NzDestroy segment r) rrzrrrfr SharedMemoryrunlink)r,rZsegmentrrrdestroy_segments   z$_SharedMemoryTracker.destroy_segmentcCs"|jddD]}||qdSr)rrrrrrrsz_SharedMemoryTracker.unlinkcCs(td|jjdt|dS)NzCall z .__del__ in )rrzr3r4rrr.rrr__del__sz_SharedMemoryTracker.__del__cCs |j|jfSrrr.rrrr/sz!_SharedMemoryTracker.__getstate__cCs|j|dSr)r-r0rrrr2sz!_SharedMemoryTracker.__setstate__N) r4r6r7r-rrrrr/r2rrrrrs  rc@sReZdZejdddgZddZddZde_d d Zd d Z d dZ ddZ dS)SharedMemoryServer track_segmentrelease_segment list_segmentscOsZtj|f|||j}t|tr,t|}td|dt|_ t dtdS)NZshm_rTz"SharedMemoryServer started by pid ) rVr-r*rGrcosfsdecoderrshared_memory_contextrrz)r,r?kwargsr*rrrr- s  zSharedMemoryServer.__init__cOstt|dkr|d}n4d|kr(|d}n"|s6tdntdt|dttj|ddrhtj|d <tj||S) Nrrr)zDdescriptor 'create' of 'SharedMemoryServer' object needs an argumentrr rZ_shared_memory_proxyr)rrIrr,rdrrVrX)r?rZtypeodr)rrrrXs      zSharedMemoryServer.createz&($self, c, typeid, /, *args, **kwargs)cCs|jt||Sr)rrrVrWrrrrrW)s zSharedMemoryServer.shutdowncCs|j|dSr)rrr,r=rrrrr.sz SharedMemoryServer.track_segmentcCs|j|dSr)rrrrrrr2sz"SharedMemoryServer.release_segmentcCs|jjSr)rrrrrrr7sz SharedMemoryServer.list_segmentsN) r4r6r7rVrr-rXrrWrrrrrrrrs rc@s8eZdZeZddZddZddZddZd d Z d S) rcOsNtjdkrddlm}|tj|f||t|j j dt dS)Nposixr )resource_trackerz created by pid ) rrrZensure_runningrr-rrzr3r4r)r,r?rrrrrr-Is   zSharedMemoryManager.__init__cCst|jjdtdS)Nz.__del__ by pid )rrzr3r4rr.rrrrUszSharedMemoryManager.__del__cCsh|jjtjkrP|jjtjkr&tdn*|jjtjkr>tdntd|jj||j |j |j |j S)Nz"Already started SharedMemoryServerz!SharedMemoryManager has shut downr) rrrrrr rrJrrrrrr.rrrrYs    zSharedMemoryManager.get_serverc Csx|j|j|jd\}tjdd|d}zt|dd|jfWn.tk rh}z||W5d}~XYnXW5QRX|S)NrT)rXsizer) rrrrrrCr BaseExceptionr)r,rrZsmsrrrrrfs z SharedMemoryManager.SharedMemoryc Csv|j|j|jdZ}t|}zt|dd|jjfWn0tk rf}z|j |W5d}~XYnXW5QRX|S)Nrr) rrrr ShareableListrCZshmrrr)r,r3rZslrrrrrrs   z!SharedMemoryManager.ShareableListN) r4r6r7rrr-rrrrrrrrr=s     )NNNT)T)S__all__rwrlrrZqueuerDrrrrrr contextr r r rrrrrZ HAS_SHMEM ImportErrorrrZ view_typesr$r'Z view_typerSrrCr<rrKrSrUrVrrprqZ XmlListenerZ XmlClientrgrrrrr#r)rr*r-r4r5r:r?rGrIrPrWrXrirkrroZ BasePoolProxyrprrxrsrmryrzr{r|r}r~rrrrrrrr s            c   w 4             %8