
    Χg                     \    d dl Zd dlmZ ddlmZ d Z G d dej        j                  ZdS )    N   )SimpleQueuec                  b    dd l }t          j        j        | i | |                                 d S )Nr   )gcmultiprocessingpoolworkercollect)argskwargsr   s      V/var/www/html/ai-engine/env/lib/python3.11/site-packages/torch/multiprocessing/pool.pyclean_workerr      s7    III0000 JJLLLLL    c                       e Zd ZdZd Zd ZdS )PoolzPool implementation which uses our version of SimpleQueue.

    This lets us pass tensors in shared memory across processes instead of
    serializing the underlying data.
    c                     t                      | _        t                      | _        | j        j        j        | _        | j        j        j        | _        d S )N)	r   _inqueue	_outqueue_writersend
_quick_put_readerrecv
_quick_get)selfs    r   _setup_queueszPool._setup_queues   s:    #$-/4.05r   c                    t          | j        t          | j                  z
            D ]}| j        | j        | j        | j        | j        f}t          | d          r|| j
        fz  }|                     t          |          }| j                            |           |j                            dd          |_        d|_        |                                 t%          j        d           dS )zIncrease the number of pool processes to the specified number.

        Bring the number of pool processes up to the specified number, for use after
        reaping workers which have exited.
        _wrap_exception)targetr   Process
PoolWorkerTzadded workerN)range
_processeslen_poolr   r   _initializer	_initargs_maxtasksperchildhasattrr   r    r   appendnamereplacedaemonstartutildebug)r   ir   ws       r   _repopulate_poolzPool._repopulate_pool   s     tTZ899 	' 	'A !&D t.// 0-//Lt<<AJa   V^^I|<<AFAHGGIIIJ~&&&&!	' 	'r   N)__name__
__module____qualname____doc__r   r3    r   r   r   r      s<         6 6 6' ' ' ' 'r   r   )	multiprocessing.poolr   multiprocessing.utilr/   queuer   r   r   r   r8   r   r   <module>r<      s~        # # # # # #        #' #' #' #' #'?$ #' #' #' #' #'r   