관리-도구
편집 파일: shared_memory.cpython-311.pyc
� c��fH � � � d Z ddgZddlmZ ddlZddlZddlZddlZddlZddl Z ej dk rddlZdZnddl Z dZd d lmZ ej ej z ZdZerdZnd Zd� Z G d� d� � ZdZ G d� d� � ZdS )z�Provides shared memory for direct access across processes. The API of this package is currently provisional. Refer to the documentation for details. �SharedMemory� ShareableList� )�partialN�ntFT� )�resource_tracker� z/psm_�wnsm_c �� � t t t � � z dz } | dk s J d� � �t t j | � � z }t |� � t k sJ �|S )z6Create a random filename for the shared memory object.� z_SHM_NAME_PREFIX too long)�_SHM_SAFE_NAME_LENGTH�len�_SHM_NAME_PREFIX�secrets� token_hex)�nbytes�names �D/opt/alt/python311/lib64/python3.11/multiprocessing/shared_memory.py�_make_filenamer ( sb � � $�c�*:�&;�&;�;�� A�F��Q�;�;�;�3�;�;�;��g�/��7�7�7�D��t�9�9�-�-�-�-�-��K� c � � e Zd ZdZdZdZdZdZej Z dZerdndZ dd�Zd � Zd � Zd� Zed� � � Zed � � � Zed� � � Zd� Zd� ZdS )r a� Creates a new shared memory block or attaches to an existing shared memory block. Every shared memory block is assigned a unique name. This enables one process to create a shared memory block with a particular name so that a different process can attach to that same shared memory block using that same name. As a resource for sharing data across processes, shared memory blocks may outlive the original process that created them. When one process no longer needs access to a shared memory block that might still be needed by other processes, the close() method should be called. When a shared memory block is no longer needed by any process, the unlink() method should be called to ensure proper cleanup.N���i� TFr c �x � |dk st d� � �|r.t t j z | _ |dk rt d� � �|�#| j t j z st d� � �t �r*|�O t � � } t j || j | j �� � | _ n# t $ r Y �Cw xY w|| _ n;| j rd|z n|}t j || j | j �� � | _ || _ |r|rt j | j |� � t j | j � � }|j }t% j | j |� � | _ n## t( $ r | � � � � w xY wt- j | j d� � �n�|�r# |�t � � n|}t1 j t0 j t0 j t0 j |d z d z |d z |� � } t1 j � � }|t0 j k rZ|�Bt t>