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-1.pyc

B

� f�"�@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�
BufferWrapperZwin32c@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�irZbuf�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
)rrrrr)r�staterrr�__setstate__5szArena.__setstate__N)	�__name__�
__module__�__qualname__�tempfileZ_RandomNameSequencerrrrrrrrrsrc@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#Zmkstempr
r�_choose_dir�unlinkr�Finalizer�	ftruncaterr)rrr&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_arenarrZDupFd)�arrr�reduce_arenaYs
r6cCst||���S)N)r�detach)rZdupfdrrrr4_sr4c@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)r
r�_lastpid�	threadingZLock�_lock�_size�_lengths�_len_to_seq�_start_to_block�_stop_to_block�set�_allocated_blocks�_arenas�_pending_free_blocks)rrrrrrls

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>�lenrH�maxr=r�PAGESIZEr�inforrD�appendr?�popr@rA)	rrr�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)	rA�KeyError�_absorbr@r?rOrJZinsortr>)	rrTrRrUrVZ
prev_block�_Z
next_blockrQrrr�_free�s(

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

zHeap._absorbcCsFx@y|j��}Wntk
r&PYnX|j�|�|�|�qWdS)N)rErP�
IndexErrorrCr\r[)rrTrrr�_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)r
rr:r3�formatr<�acquirerErOr^rCr\r[�release)rrTrrr�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)r3r_r1�maxsize�
OverflowErrorr
rr:rr<r^rHrL�
_alignmentrWr[rC�add)rrrRrUrVZnew_stoprTrrr�malloc�s 

zHeap.mallocN)r r!r"rerrMr�staticmethodrHrWr[rYr^rbrgrrrrr8hs

r8c@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)r3r_r1rcrdr�_heaprgrrr)rb)rrrTrrrrs

zBufferWrapper.__init__cCs&|j\\}}}}t|j�|||�S)N)r�
memoryviewr)rrRrUrVrrrr�create_memoryviewszBufferWrapper.create_memoryviewN)r r!r"r8rjrrlrrrrr�s	)rJrr
r1r#r;�contextrr�r�__all__r2r�objectrr6r4�registerr8rrrrr�<module>
s$
 

Hacked By AnonymousFox1.0, Coded By AnonymousFox