Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/multiprocessing/heap.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c@s
ddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddlmZdgZ
ejdkr�ddlmZdefd��YZndefd	��YZd
efd��YZdefd��YZdS(
i�N(tFinalizetinfo(tassert_spawningt
BufferWrappertwin32(RtArenacBs/eZej�Zd�Zd�Zd�ZRS(cCse||_dtj�tjj�f|_tjd|jd|j�|_|j|jf|_	dS(Ns	pym-%d-%di�ttagname(
tsizetostgetpidRt_countertnexttnametmmaptbuffert_state(tselfR((s*/sys/lib/python2.7/multiprocessing/heap.pyt__init__=s	"!cCst|�|jS(N(RR(R((s*/sys/lib/python2.7/multiprocessing/heap.pyt__getstate__Ds
cCs>|\|_|_|_tjd|jd|j�|_dS(Ni�R(RRRR
R(Rtstate((s*/sys/lib/python2.7/multiprocessing/heap.pyt__setstate__Hs!(t__name__t
__module__t	itertoolstcountR
RRR(((s*/sys/lib/python2.7/multiprocessing/heap.pyR9s		cBseZd�ZRS(cCs+tjd|�|_||_d|_dS(Ni�(R
RRtNoneR(RR((s*/sys/lib/python2.7/multiprocessing/heap.pyRQs	(RRR(((s*/sys/lib/python2.7/multiprocessing/heap.pyROstHeapcBsbeZdZejd�Zed��Zd�Zd�Z	d�Z
d�Zd�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*/sys/lib/python2.7/multiprocessing/heap.pyR^s						cCs|d}|||@S(Ni((tnt	alignmenttmask((s*/sys/lib/python2.7/multiprocessing/heap.pyt_roundupks
c	Cstj|j|�}|t|j�kr�|jt|j|�tj�}|jd9_t	d|�t
|�}|jj|�|d|fS|j|}|j
|}|j�}|s�|j
|=|j|=n|\}}}|j||f=|j||f=|S(Nis"allocating a new mmap of length %di(tbisecttbisect_leftR tlenR+tmaxRR
tPAGESIZERRR&tappendR!tpopR"R#(	RRtitlengthtarenatseqtblocktstarttstop((s*/sys/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|<tj|j|�nX||j||f<||j||f<dS(N(	R#tKeyErrort_absorbR"R!R1R,tinsortR (	RR7R5R8R9t
prev_blockt_t
next_blockR4((s*/sys/lib/python2.7/multiprocessing/heap.pyt_free�s(



cCs�|\}}}|j||f=|j||f=||}|j|}|j|�|sv|j|=|jj|�n||fS(N(R"R#R!tremoveR (RR7R5R8R9R4R6((s*/sys/lib/python2.7/multiprocessing/heap.pyR<�s



cCsVxOtrQy|jj�}Wntk
r0PnX|jj|�|j|�qWdS(N(tTrueR'R2t
IndexErrorR%RBRA(RR7((s*/sys/lib/python2.7/multiprocessing/heap.pyt_free_pending_blocks�s	
cCse|jjt�s%|jj|�n<z+|j�|jj|�|j|�Wd|jj	�XdS(N(
RtacquiretFalseR'R1RER%RBRAtrelease(RR7((s*/sys/lib/python2.7/multiprocessing/heap.pytfree�s
cCs�tj�|jkr"|j�n|jj�|j�z�|jt|d�|j	�}|j
|�\}}}||}||kr�|j|||f�n|||f}|jj
|�|SWd|jj�XdS(Ni(RR	RRRRFRER+R/t
_alignmentR:RAR%taddRH(RRR5R8R9tnew_stopR7((s*/sys/lib/python2.7/multiprocessing/heap.pytmalloc�s



(RRRJR
R0RtstaticmethodR+R:RAR<RERIRM(((s*/sys/lib/python2.7/multiprocessing/heap.pyRZs
				
	cBs,eZe�Zd�Zd�Zd�ZRS(cCsAtjj|�}||f|_t|tjjd|f�dS(Ntargs(Rt_heapRMRRRI(RRR7((s*/sys/lib/python2.7/multiprocessing/heap.pyR�scCs8|j\\}}}}tj|j�\}}||S(N(Rt_multiprocessingtaddress_of_bufferR(RR5R8R9RtaddressR4((s*/sys/lib/python2.7/multiprocessing/heap.pytget_address�scCs|jdS(Ni(R(R((s*/sys/lib/python2.7/multiprocessing/heap.pytget_size�s(RRRRPRRTRU(((s*/sys/lib/python2.7/multiprocessing/heap.pyR�s			(R,R
ttempfileRtsysRRRQtmultiprocessing.utilRRtmultiprocessing.forkingRt__all__tplatformRtobjectRRR(((s*/sys/lib/python2.7/multiprocessing/heap.pyt<module>#s 	

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].