python (3.11.7)
    e/                        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 ))LockRLock	SemaphoreBoundedSemaphore	ConditionEvent    N   )context)process)util)SemLock
sem_unlinkzThis 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 )Nforkwin32d   zcannot find name for semaphorezcreated semlock with handle %sc                 8    | j                                          d S N)_semlock_after_fork)objs    O/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/multiprocessing/synchronize.pyr   z%SemLock.__init__.<locals>._after_forkG   s    ((*****    r	   )register	semaphorer   )exitpriority)r
   _default_contextget_contextget_start_method_is_fork_ctxsysplatformrange_multiprocessingr
   
_make_namer   FileExistsErrorr   debughandle
_make_methodsregister_after_forknameresource_trackerr   Finalize_cleanup)
selfkindvaluemaxvaluectx
unlink_nowislr   r   s
             r   __init__zSemLock.__init__2   s   ;*6688C0022f<\W,A0A
s 
	D 
	DA
%5%=%4??+<+<&  &   T]  # 
 
 
 ""BCCC
3bi?@@@<7""
+ 
+ 
+$T;777=) 
322222HT]'555M$ 04=3E2G'(
* 
* 
* 
* 
* 
*
 *)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:    0000004
4%%%%%r   c                 J    | j         j        | _        | j         j        | _        d S r   )r   acquirereleaser1   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   zA 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_popenduplicate_for_childr*   r"