ok

Mini Shell

Direktori : /usr/lib64/python3.6/multiprocessing/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/multiprocessing/__pycache__/heap.cpython-36.pyc

3


 \ �@s�ddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
dgZejdkrvddl
Z
Gdd�de�Zn,Gd	d�de�Zd
d�Zdd
�Zejee�Gdd�de�ZGdd�de�ZdS)�N�)�	reduction�assert_spawning)�util�
BufferWrapperZwin32c@s,eZdZej�Zdd�Zdd�Zdd�ZdS)�ArenacCsz||_xTtd�D]@}dtj�t|j�f}tjd||d�}tj�dkrHP|j	�qWt
d��||_||_|j|jf|_
dS)N�dz	pym-%d-%sr)�tagnamerzCannot find name for new mmap���)�size�range�os�getpid�next�_rand�mmap�_winapiZGetLastError�close�FileExistsError�name�buffer�_state)�selfr�irZbuf�r�,/usr/lib64/python3.6/multiprocessing/heap.py�__init__"szArena.__init__cCst|�|jS)N)rr)rrrr�__getstate__1szArena.__getstate__cCs,|\|_|_|_tjd|j|jd�|_dS)Nr)r	r
)rrrrr)r�staterrr�__setstate__5szArena.__setstate__N)	�__name__�
__module__�__qualname__�tempfileZ_RandomNameSequencerrrrrrrrrsrc@seZdZddd�ZdS)rrcCs�||_||_|d	kr�tjdtj�tj�d�\|_}tj|�tj	|tj
|jf�t|jddd��^}d
}||kr�d|}xt||�D]}|j
|�q�W~|j
d||�|j�|ks�t�WdQRXtj|j|j�|_dS)Nrzpym-%d-)�prefix�dir�wbF)�closefdi�r
i)r�fdr#Zmkstempr
rrZget_temp_dir�unlink�Finalizer�openr�write�tell�AssertionErrorrr)rrr)r�fZbsZzeros�_rrrr@s"
zArena.__init__Nr
)r
)r r!r"rrrrrr>scCs(|jdkrtd��t|jtj|j�ffS)NrzDArena is unpicklable because forking was enabled when it was createdr
)r)�
ValueError�
rebuild_arenarrZDupFd)�arrr�reduce_arenaSs
r5cCst||j��S)N)r�detach)rZdupfdrrrr3Ysr3c@sZeZdZdZejfdd�Zedd��Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�ZdS)�Heap�cCsJtj�|_tj�|_||_g|_i|_i|_	i|_
t�|_g|_
g|_dS)N)r
r�_lastpid�	threadingZLock�_lock�_size�_lengths�_len_to_seq�_start_to_block�_stop_to_block�set�_allocated_blocks�_arenas�_pending_free_blocks)rrrrrrfs

z
Heap.__init__cCs|d}|||@S)Nrr)�nZ	alignment�maskrrr�_roundupssz
Heap._roundupc	Cs�tj|j|�}|t|j�krj|jt|j|�tj�}|jd9_t	j
d|�t|�}|jj
|�|d|fS|j|}|j|}|j�}|s�|j|=|j|=|\}}}|j||f=|j||f=|S)N�z"allocating a new mmap of length %dr)�bisectZbisect_leftr=�lenrG�maxr<r�PAGESIZEr�inforrC�appendr>�popr?r@)	rrr�length�arena�seq�block�start�stoprrr�_mallocys"



zHeap._mallocc	Cs�|\}}}y|j||f}Wntk
r0YnX|j|�\}}y|j||f}Wntk
rfYnX|j|�\}}|||f}||}y|j|j|�Wn.tk
r�|g|j|<tj|j|�YnX||j||f<||j||f<dS)N)	r@�KeyError�_absorbr?r>rNrIZinsortr=)	rrSrQrTrUZ
prev_blockr1Z
next_blockrPrrr�_free�s(

z
Heap._freecCs^|\}}}|j||f=|j||f=||}|j|}|j|�|sV|j|=|jj|�||fS)N)r?r@r>�remover=)rrSrQrTrUrPrRrrrrX�s


zHeap._absorbcCsFx@y|jj�}Wntk
r&PYnX|jj|�|j|�qWdS)N)rDrO�
IndexErrorrBrZrY)rrSrrr�_free_pending_blocks�szHeap._free_pending_blocksc
Cs`tj�|jkst�|jjd�s,|jj|�n0z"|j�|j	j
|�|j|�Wd|jj�XdS)NF)
r
rr9r/r;�acquirerDrNr\rBrZrY�release)rrSrrr�free�s
z	Heap.freecCs�d|kotjknst�tj�|jkr4|j�|j�h|j�|j	t
|d�|j�}|j|�\}}}||}||kr�|j
|||f�|||f}|jj|�|SQRXdS)Nrr)�sys�maxsizer/r
rr9rr;r\rGrK�
_alignmentrVrYrB�add)rrrQrTrUZnew_stoprSrrr�malloc�s
zHeap.mallocN)r r!r"rbrrLr�staticmethodrGrVrYrXr\r_rdrrrrr7bs

r7c@s"eZdZe�Zdd�Zdd�ZdS)rcCsNd|kotjknst�tjj|�}||f|_tj|tjj	|fd�dS)Nr)�args)
r`rar/r�_heaprdrrr+r_)rrrSrrrr�s
zBufferWrapper.__init__cCs&|j\\}}}}t|j�|||�S)N)r�
memoryviewr)rrQrTrUrrrr�create_memoryview�szBufferWrapper.create_memoryviewN)r r!r"r7rgrrirrrrr�s)rIrr
r`r#r:�contextrr�r�__all__�platformr�objectrr5r3�registerr7rrrrr�<module>
s$
 

Zerion Mini Shell 1.0