관리-도구
편집 파일: queues.cpython-39.opt-2.pyc
a �����DOg�.����������������������@���s����g�d��Z�ddlZddlZddlZddlZddlZddlZddlZddlZddl m Z mZ�ddlZddl mZ�ddl mZ�ejjZddlmZmZmZmZmZ�G�dd ��d e�Ze��ZG�d d��de�ZG�dd ��d e�ZdS�))�Queue�SimpleQueue� JoinableQueue�����N)�Empty�Full����)� connection)�context)�debug�info�Finalize�register_after_fork� is_exitingc�������������������@���s����e�Zd�Zd-dd�Zdd��Zdd��Zdd ��Zd.dd�Zd/dd�Zd0dd�Z dd��Z dd��Zdd��Zdd��Z dd��Zdd��Zdd ��Zd!d"��Zd#d$��Zed%d&���Zed'd(���Zed)d*���Zed+d,���ZdS�)1r���r���c����������������C���s����|dkrddl�m}�||�_tjdd�\|�_|�_|���|�_t � ��|�_tj dkrTd�|�_n |���|�_|�|�|�_d|�_|�����tj dkr�t|�tj��d�S�)Nr���r���)� SEM_VALUE_MAXF��duplex�win32)�synchronizer����_maxsizer����Pipe�_reader�_writer�Lock�_rlock�os�getpid�_opid�sys�platform�_wlock�BoundedSemaphore�_sem� _ignore_epipe�_resetr ���r����_after_fork��self�maxsize�ctx��r)����./usr/lib64/python3.9/multiprocessing/queues.py�__init__%���s���� zQueue.__init__c�����������������C���s.���t��|���|�j|�j|�j|�j|�j|�j|�j|�j fS��N) r ����assert_spawningr"���r���r���r���r���r���r!���r����r&���r)���r)���r*����__getstate__9���s���� �zQueue.__getstate__c�������������� ���C���s0���|\|�_�|�_|�_|�_|�_|�_|�_|�_|�����d�S�r,���) r"���r���r���r���r���r���r!���r���r#����r&����stater)���r)���r*����__setstate__>���s�����zQueue.__setstate__c�����������������C���s���t�d��|�jdd��d�S�)NzQueue._after_fork()T)� after_fork)r ���r#���r.���r)���r)���r*���r$���C���s����zQueue._after_forkFc�����������������C���sj���|r|�j�����nt�t����|�_�t���|�_d�|�_d�|�_ d|�_ d|�_d�|�_|�j j|�_|�jj|�_|�jj|�_d�S��NF)� _notempty�_at_fork_reinit� threading� Conditionr����collections�deque�_buffer�_thread�_jointhread�_joincancelled�_closed�_closer���� send_bytes�_send_bytesr���� recv_bytes�_recv_bytes�poll�_poll)r&���r3���r)���r)���r*���r#���G���s���� zQueue._resetTNc�����������������C���sz���|�j�rtd|��d���|�j�||�s(t�|�j�8�|�jd�u�rB|�����|�j� |��|�j� ���W�d�����n1�sl0����Y��d�S��NzQueue z is closed)r?���� ValueErrorr!����acquirer���r5���r<���� _start_threadr;����append�notify�r&����obj�block�timeoutr)���r)���r*����putV���s���� z Queue.putc�����������������C���s����|�j�rtd|��d���|r\|d�u�r\|�j��|����}W�d�����n1�sF0����Y��|�j����n||rlt���|�}|�j�||�s~t �zL|r�|t����}|�� |�s�t �n|�� ��s�t �|����}|�j����W�|�j����n|�j����0�t�|�S�rG���) r?���rH���r���rD���r!����release�time� monotonicrI���r���rF����_ForkingPickler�loads)r&���rO���rP����res�deadliner)���r)���r*����getb���s*����& z Queue.getc�����������������C���s���|�j�|�jj����S�r,���)r���r!����_semlock� _get_valuer.���r)���r)���r*����qsize|���s����zQueue.qsizec�����������������C���s ���|������S�r,����rF���r.���r)���r)���r*����empty����s����zQueue.emptyc�����������������C���s���|�j�j���S�r,���)r!���rZ����_is_zeror.���r)���r)���r*����full����s����z Queue.fullc�����������������C���s ���|���d�S�r4���)rY���r.���r)���r)���r*���� get_nowait����s����zQueue.get_nowaitc�����������������C���s���|���|d�S�r4���)rQ����r&���rN���r)���r)���r*���� put_nowait����s����zQueue.put_nowaitc�����������������C���s ���d|�_�|�j}|rd�|�_|���d�S�)NT)r?���r@���)r&����closer)���r)���r*���rd�������s ����zQueue.closec�����������������C���s���t�d��|�jr|�����d�S�)NzQueue.join_thread())r ���r=���r.���r)���r)���r*����join_thread����s����zQueue.join_threadc�����������������C���s4���t�d��d|�_z|�j����W�n�ty.���Y�n0�d�S�)NzQueue.cancel_join_thread()T)r ���r>���r=����cancel�AttributeErrorr.���r)���r)���r*����cancel_join_thread����s����zQueue.cancel_join_threadc�����������������C���s����t�d��|�j����tjtj|�j|�j|�j|�j |�j j|�jj|�j |�j|�jf dd�|�_d|�j_t�d��|�j����t�d��|�js�t|�jtjt�|�j�gdd�|�_t|�tj|�j|�jgd d�|�_d�S�) NzQueue._start_thread()�QueueFeederThread)�target�args�nameTzdoing self._thread.start()z... done self._thread.start()���)�exitpriority� ���)r ���r;����clearr7����Threadr����_feedr5���rB���r���r���rd���r���r"����_on_queue_feeder_errorr!���r<����daemon�startr>���r����_finalize_join�weakref�refr=����_finalize_closer@���r.���r)���r)���r*���rJ�������s4���� �� � �zQueue._start_threadc�����������������C���s4���t�d��|���}|d�ur(|����t�d��nt�d��d�S�)Nzjoining queue threadz... queue thread joinedz... queue thread already dead)r ����join)�twr�threadr)���r)���r*���rv�������s���� zQueue._finalize_joinc�����������������C���sB���t�d��|�"�|��t��|����W�d�����n1�s40����Y��d�S�)Nztelling queue thread to quit)r ���rK���� _sentinelrL���)�buffer�notemptyr)���r)���r*���ry�������s���� zQueue._finalize_closec �������������� ���C���sr��t�d��|j} |j} |j}|�j}t} tjdkr<|j}|j}nd�}z�| ���z|�sT|���W�| ���n| ���0�zn|��}|| u�r�t�d��|���|���W�W�d�S�t� |�}|d�u�r�||��qh|���z||��W�|���qh|���0�qhW�n�t y����Y�n0�W�q@�t�yj�}�zf|�r$t|dd�t jk�r$W�Y�d�}~d�S�t���rDtd|��W�Y�d�}~d�S�|����|||��W�Y�d�}~q@d�}~0�0�q@d�S�)Nz$starting thread to feed data to piper���z%feeder thread got sentinel -- exiting�errnor���zerror in queue thread: %s)r ���rI���rR����wait�popleftr}���r���r���rU����dumps� IndexError� Exception�getattrr�����EPIPEr���r���)r~���r���rA���� writelock�reader_close�writer_close�ignore_epipe�onerror� queue_sem�nacquire�nrelease�nwait�bpopleft�sentinel�wacquire�wreleaserN����er)���r)���r*���rr�������sP���� zQueue._feedc�����������������C���s���dd�l�}|����d�S�)Nr���)� traceback� print_exc)r����rN���r����r)���r)���r*���rs�����s����zQueue._on_queue_feeder_error)r���)F)TN)TN)�__name__� __module__�__qualname__r+���r/���r2���r$���r#���rQ���rY���r\���r^���r`���ra���rc���rd���re���rh���rJ����staticmethodrv���ry���rr���rs���r)���r)���r)���r*���r���#���s0��� ! >r���c�������������������@���s@���e�Zd�Zddd�Zdd��Zdd��Zdd d�Zdd ��Zdd��Zd S�)r���r���c����������������C���s*���t�j|�||d��|�d�|�_|���|�_d�S�)N)r(���r���)r���r+���� Semaphore�_unfinished_tasksr8����_condr%���r)���r)���r*���r+���(��s����zJoinableQueue.__init__c�����������������C���s���t��|��|�j|�jf�S�r,���)r���r/���r����r����r.���r)���r)���r*���r/���-��s����zJoinableQueue.__getstate__c�����������������C���s,���t��|�|d�d����|dd���\|�_|�_d�S�)N���)r���r2���r����r����r0���r)���r)���r*���r2���0��s����zJoinableQueue.__setstate__TNc�������������� ���C���s����|�j�rtd|��d���|�j�||�s(t�|�j�h�|�j�B�|�jd�u�rJ|�����|�j � |��|�j����|�j� ���W�d�����n1�s~0����Y��W�d�����n1�s�0����Y��d�S�rG���)r?���rH���r!���rI���r���r5���r����r<���rJ���r;���rK���r����rR���rL���rM���r)���r)���r*���rQ���4��s���� zJoinableQueue.putc�����������������C���sT���|�j��:�|�j�d�std��|�jj���r2|�j�����W�d�����n1�sF0����Y��d�S�)NFz!task_done() called too many times)r����r����rI���rH���rZ���r_���� notify_allr.���r)���r)���r*���� task_doneA��s ����zJoinableQueue.task_donec�����������������C���s@���|�j��&�|�jj���s|�j�����W�d�����n1�s20����Y��d�S�r,���)r����r����rZ���r_���r����r.���r)���r)���r*���rz���H��s����zJoinableQueue.join)r���)TN) r����r����r����r+���r/���r2���rQ���r����rz���r)���r)���r)���r*���r���&��s��� r���c�������������������@���sN���e�Zd�Zdd��Zdd��Zdd��Zdd��Zd d ��Zdd��Zd d��Z e ej�Z dS�)r���c����������������C���sH���t�jdd�\|�_|�_|���|�_|�jj|�_tj dkr:d�|�_ n |���|�_ d�S�)NFr���r���)r���r���r���r���r���r���rE���rF���r���r���r���)r&���r(���r)���r)���r*���r+���S��s���� zSimpleQueue.__init__c�����������������C���s���|�j�����|�j����d�S�r,���)r���rd���r���r.���r)���r)���r*���rd���\��s���� zSimpleQueue.closec�����������������C���s ���|������S�r,���r]���r.���r)���r)���r*���r^���`��s����zSimpleQueue.emptyc�����������������C���s���t��|���|�j|�j|�j|�jfS�r,���)r ���r-���r���r���r���r���r.���r)���r)���r*���r/���c��s���� zSimpleQueue.__getstate__c�����������������C���s"���|\|�_�|�_|�_|�_|�j�j|�_d�S�r,���)r���r���r���r���rE���rF���r0���r)���r)���r*���r2���g��s����zSimpleQueue.__setstate__c�����������������C���s:���|�j���|�j���}W�d�����n1�s&0����Y��t�|�S�r,���)r���r���rC���rU���rV���)r&���rW���r)���r)���r*���rY���k��s����(zSimpleQueue.getc�����������������C���sX���t��|�}|�jd�u�r"|�j�|��n2|�j��|�j�|��W�d�����n1�sJ0����Y��d�S�r,���)rU���r����r���r���rA���rb���r)���r)���r*���rQ���q��s ���� zSimpleQueue.putN)r����r����r����r+���rd���r^���r/���r2���rY���rQ����classmethod�types�GenericAlias�__class_getitem__r)���r)���r)���r*���r���Q��s��� r���)�__all__r���r���r7���r9���rS���r����rw���r�����queuer���r����_multiprocessing��r���r ���� reduction�ForkingPicklerrU����utilr ���r���r���r ���r����objectr���r}���r���r���r)���r)���r)���r*����<module> ���s&����z +