관리-도구
편집 파일: synchronize.cpython-311.opt-2.pyc
� c��f�/ � �� � g d �Z ddlZddlZddlZddlZddlZddlmZ ddlmZ ddlm Z ddlm Z mZ n# e$ r ed� � �w xY w e ed � � � � \ ZZej j Z G d � de� � Z G d� d e � � Z G d� de� � Z G d� de � � Z G d� de � � Z G d� de� � Z G d� de� � Z G d� dej � � ZdS ))�Lock�RLock� Semaphore�BoundedSemaphore� Condition�Event� N� )�context)�process)�util)�SemLock� sem_unlinkz�This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.� c �| � e Zd Z ej � � Zd� Zed� � � Zd� Z d� Z d� Zd� Zd� Z ed� � � Zd S ) r c �� � |�t j � � � }|� � � dk | _ t j dk p| j }t d� � D ]E} t j |||| � � � |� � x}| _ n# t $ r Y �Bw xY wt d� � �t j d|j z � � | � � � t j dk rd� }t j | |� � | j j �Kddlm} | | j j d � � t j | t j | j j fd �� � d S d S )N�fork�win32�d zcannot find name for semaphorezcreated semlock with handle %sc �8 � | j � � � d S �N)�_semlock�_after_fork)�objs �B/opt/alt/python311/lib64/python3.11/multiprocessing/synchronize.pyr z%SemLock.__init__.<locals>._after_forkG s � ���(�(�*�*�*�*�*� r )�register� semaphorer )�exitpriority)r �_default_context�get_context�get_start_method�_is_fork_ctx�sys�platform�range�_multiprocessingr � _make_namer �FileExistsErrorr �debug�handle� _make_methods�register_after_fork�name�resource_trackerr �Finalize�_cleanup) �self�kind�value�maxvalue�ctx� unlink_now�i�slr r s r �__init__zSemLock.__init__2 s� � ��;��*�6�6�8�8�C��0�0�2�2�f�<����\�W�,�A��0A� ��s��� D� D�A� �%5�%=��%��4�?�?�+<�+<��& � & � ��T�]� ��� #� � � ��� ���� "�"B�C�C�C�� �3�b�i�?�@�@�@��������<�7�"�"� +� +� +��$�T�;�7�7�7��=��)� 3�2�2�2�2�2��H�T�]�'��5�5�5��M�$�� 0�4�=�3E�2G�'(� *� *� *� *� *� *� *�)s �'1B� B'�&B'c �H � ddl m} t | � � || d� � d S )Nr )� unregisterr )r. r; r )r- r; s r r0 zSemLock._cleanupT s: � �0�0�0�0�0�0��4����� �4��%�%�%�%�%r c �J � | j j | _ | j j | _ d S r )r �acquire�release�r1 s r r+ zSemLock._make_methodsZ s � ��}�,����}�,����r c �4 � | j � � � S r )r � __enter__r? s r rA zSemLock.__enter__^ s � ��}�&�&�(�(�(r c � � | j j |� S r )r �__exit__�r1 �argss r rC zSemLock.__exit__a s � �%�t�}�%�t�,�,r c � � t j | � � | j }t j dk r,t j � � � |j � � }n| j rt d� � �|j }||j |j |j fS )Nr z�A SemLock created in a fork context is being shared with a process in a spawn context. This is not supported. Please use the same context to create multiprocessing objects and Process.) r �assert_spawningr r# r$ �get_spawning_popen�duplicate_for_childr* r"