ó û^‚Rc@s ddlZddlZddlZddlZddlZddlZddlZddlZddlm Z m Z ddl m Z dgZ ejdkrÇddlmZdefd„ƒYZndefd „ƒYZd efd „ƒYZdefd „ƒYZdS( iÿÿÿÿN(tFinalizetinfo(tassert_spawningt BufferWrappertwin32(RtArenacBs/eZejƒZd„Zd„Zd„ZRS(cCsƒ||_dtjƒtjjƒf|_tjd|jd|jƒ|_t j ƒdksjt dƒ‚|j|jf|_ dS(Ns pym-%d-%diÿÿÿÿttagnameistagname already in use( tsizetostgetpidRt_countertnexttnametmmaptbufferRt GetLastErrortAssertionErrort_state(tselfR((s*/usr/lib/python2.7/multiprocessing/heap.pyt__init__=s  "!cCst|ƒ|jS(N(RR(R((s*/usr/lib/python2.7/multiprocessing/heap.pyt __getstate__Ds cCsY|\|_|_|_tjd|jd|jƒ|_tjƒtjksUt‚dS(NiÿÿÿÿR( RR RR RRRtERROR_ALREADY_EXISTSR(Rtstate((s*/usr/lib/python2.7/multiprocessing/heap.pyt __setstate__Hs!(t__name__t __module__t itertoolstcountR RRR(((s*/usr/lib/python2.7/multiprocessing/heap.pyR9s   cBseZd„ZRS(cCs+tjd|ƒ|_||_d|_dS(Niÿÿÿÿ(R RRtNoneR (RR((s*/usr/lib/python2.7/multiprocessing/heap.pyRQs (RRR(((s*/usr/lib/python2.7/multiprocessing/heap.pyROstHeapcBsbeZdZejd„Zed„ƒZd„Zd„Z d„Z d„Z d„Z d„Z RS( icCsmtjƒ|_tjƒ|_||_g|_i|_i|_ i|_ t ƒ|_ g|_ g|_dS(N(RR t_lastpidt threadingtLockt_lockt_sizet_lengthst _len_to_seqt_start_to_blockt_stop_to_blocktsett_allocated_blockst_arenast_pending_free_blocks(RR((s*/usr/lib/python2.7/multiprocessing/heap.pyR^s       cCs|d}|||@S(Ni((tnt alignmenttmask((s*/usr/lib/python2.7/multiprocessing/heap.pyt_roundupks c Cstj|j|ƒ}|t|jƒkr|jt|j|ƒtjƒ}|jd9_t d|ƒt |ƒ}|j j |ƒ|d|fS|j|}|j |}|jƒ}|sÓ|j |=|j|=n|\}}}|j||f=|j||f=|S(Nis"allocating a new mmap of length %di(tbisectt bisect_leftR#tlenR.tmaxR"R tPAGESIZERRR)tappendR$tpopR%R&( RRtitlengthtarenatseqtblocktstarttstop((s*/usr/lib/python2.7/multiprocessing/heap.pyt_mallocqs"!      c Cs!|\}}}y|j||f}Wntk r9nX|j|ƒ\}}y|j||f}Wntk rynX|j|ƒ\}}|||f}||}y|j|j|ƒWn4tk rö|g|j|#s          “