Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/multiprocessing/__pycache__/heap.cpython-37.opt-2.pyc

B

YI~d�"�@s�ddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
dgZejdkrvddl
Z
Gdd�de�Zn,Gd	d�de�Zd
d�Zdd
�Ze�ee�Gdd�de�ZGdd�de�ZdS)�N�)�	reduction�assert_spawning)�util�
BufferWrapper�win32c@s,eZdZe��Zdd�Zdd�Zdd�ZdS)�ArenacCsz||_xTtd�D]@}dt��t|j�f}tjd||d�}t��dkrHP|�	�qWt
d��||_||_|j|jf|_
dS)N�dz	pym-%d-%s���)�tagnamerzCannot find name for new mmap)�size�range�os�getpid�next�_rand�mmap�_winapiZGetLastError�close�FileExistsError�name�buffer�_state)�selfr�ir�buf�r�9/opt/alt/python37/lib64/python3.7/multiprocessing/heap.py�__init__"szArena.__init__cCst|�|jS)N)rr)rrrr�__getstate__1szArena.__getstate__cCs,|\|_|_|_tjd|j|jd�|_dS)Nr
)r)rrrrr)r�staterrr�__setstate__5szArena.__setstate__N)	�__name__�
__module__�__qualname__�tempfileZ_RandomNameSequencerrrr!rrrrrsrc@s4eZdZejdkrdgZngZd	dd�Zdd�ZdS)
rZlinuxz/dev/shmr
cCsx||_||_|dkrbtjdt��|�|�d�\|_}t�|�t�	|tj
|jf�t�|j|�t�|j|j�|_
dS)Nr
zpym-%d-)�prefix�dir)r�fdr%Zmkstemprr�_choose_dir�unlinkr�Finalizer�	ftruncaterr)rrr(rrrrrDs

zArena.__init__cCs6x,|jD]"}t�|�}|j|j|kr|SqWt��S)N)�_dir_candidatesr�statvfs�f_bavail�f_frsizerZget_temp_dir)rr�d�strrrr)Ps

zArena._choose_dirN)r
)r"r#r$�sys�platformr-rr)rrrrr>s


cCs(|jdkrtd��t|jt�|j�ffS)Nr
zDArena is unpicklable because forking was enabled when it was created)r(�
ValueError�
rebuild_arenarrZDupFd)�arrr�reduce_arenaYs
r8cCst||���S)N)r�detach)rZdupfdrrrr6_sr6c@sZeZdZdZejfdd�Zedd��Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�ZdS)�Heap�cCsJt��|_t��|_||_g|_i|_i|_	i|_
t�|_g|_
g|_dS)N)rr�_lastpid�	threadingZLock�_lock�_size�_lengths�_len_to_seq�_start_to_block�_stop_to_block�set�_allocated_blocks�_arenas�_pending_free_blocks)rrrrrrls

z
Heap.__init__cCs|d}|||@S)Nrr)�nZ	alignment�maskrrr�_roundupysz
Heap._roundupc	Cs�t�|j|�}|t|j�krj|�t|j|�tj�}|jd9_t	�
d|�t|�}|j�
|�|d|fS|j|}|j|}|��}|s�|j|=|j|=|\}}}|j||f=|j||f=|S)N�z"allocating a new mmap of length %dr)�bisectZbisect_leftr@�lenrJ�maxr?r�PAGESIZEr�inforrF�appendrA�poprBrC)	rrr�length�arena�seq�block�start�stoprrr�_mallocs"



zHeap._mallocc	Cs�|\}}}y|j||f}Wntk
r0YnX|�|�\}}y|j||f}Wntk
rfYnX|�|�\}}|||f}||}y|j|�|�Wn.tk
r�|g|j|<t�|j|�YnX||j||f<||j||f<dS)N)	rC�KeyError�_absorbrBrArQrLZinsortr@)	rrVrTrWrXZ
prev_block�_Z
next_blockrSrrr�_free�s(

z
Heap._freecCs^|\}}}|j||f=|j||f=||}|j|}|�|�|sV|j|=|j�|�||fS)N)rBrCrA�remover@)rrVrTrWrXrSrUrrrr[�s


zHeap._absorbcCsFx@y|j��}Wntk
r&PYnX|j�|�|�|�qWdS)N)rGrR�
IndexErrorrEr^r])rrVrrr�_free_pending_blocks�szHeap._free_pending_blockscCsrt��|jkr$td�t��|j���|j�d�s>|j�|�n0z"|�	�|j
�|�|�|�Wd|j�
�XdS)Nz$My pid ({0:n}) is not last pid {1:n}F)rrr<r5�formatr>�acquirerGrQr`rEr^r]�release)rrVrrr�free�s
z	Heap.freec	Cs�|dkrtd�|���tj|kr.td�|���t��|jkrD|��|j	�h|�
�|�t|d�|j
�}|�|�\}}}||}||kr�|�|||f�|||f}|j�|�|SQRXdS)NrzSize {0:n} out of rangezSize {0:n} too larger)r5rar3�maxsize�
OverflowErrorrrr<rr>r`rJrN�
_alignmentrYr]rE�add)rrrTrWrXZnew_stoprVrrr�malloc�s 

zHeap.mallocN)r"r#r$rgrrOr�staticmethodrJrYr]r[r`rdrirrrrr:hs

r:c@s"eZdZe�Zdd�Zdd�ZdS)rcCs^|dkrtd�|���tj|kr.td�|���tj�|�}||f|_t	j
|tjj|fd�dS)NrzSize {0:n} out of rangezSize {0:n} too large)�args)r5rar3rerfr�_heaprirrr+rd)rrrVrrrrs

zBufferWrapper.__init__cCs&|j\\}}}}t|j�|||�S)N)r�
memoryviewr)rrTrWrXrrrr�create_memoryviewszBufferWrapper.create_memoryviewN)r"r#r$r:rlrrnrrrrr�s	)rLrrr3r%r=�contextrr�r�__all__r4r�objectrr8r6�registerr:rrrrr�<module>
s$
 

Hacked By AnonymousFox1.0, Coded By AnonymousFox