Current File : //proc/self/root/lib/python3/dist-packages/twisted/test/__pycache__/test_threadpool.cpython-312.pyc
�

Ϫ�f�V��X�dZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
mZmZm
Z
ddlmZGd�d�Zej"e�Gd�d	ej$�ZGd
�dej$�ZGd�d
e
j*�ZGd�d�ZGd�dej$�Zy)z(
Tests for L{twisted.python.threadpool}
�N)�Team�createMemoryWorker)�context�failure�
threadable�
threadpool)�unittestc�"�eZdZdZd�Zd�ZdgZy)�Synchronizationrc�`�||_||_tj�|_g|_y�N)�N�waiting�	threading�Lock�lock�runs)�selfrrs   �>/usr/lib/python3/dist-packages/twisted/test/test_threadpool.py�__init__zSynchronization.__init__s%���������N�N�$��	���	�c�
�|jjd�rHt|j�dzst	j
d�|jj
�n|xjdz
c_|jj�|jjd�t|j�|jk(r|jj
�|jj
�y)NF�g-C��6*?�)r�acquire�lenr�time�sleep�release�failures�appendrr�rs r�runzSynchronization.runs����9�9���U�#��t�y�y�>�A�%��
�
�6�"��I�I�����M�M�Q��M�
	
�	�	�����	�	������t�y�y�>�T�V�V�#��L�L� � �"��	�	���rr#N)�__name__�
__module__�__qualname__r rr#�synchronized�rrrrs���H���0�7�Lrrc��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zy)�ThreadPoolTestsz
    Test threadpools.
    c��y)zD
        Return number of seconds to wait before giving up.
        rr(r"s r�
getTimeoutzThreadPoolTests.getTimeout@���rc��td�}|D]*}|jd�rytjd��,|j	d�y)Ni@BFg�h㈵��>z%A long time passed without succeeding)�rangerrr�fail)rr�items�is    r�_waitForLockzThreadPoolTests._waitForLockFsD���g����	?�A��|�|�E�"���J�J�t��	?�

�I�I�=�>rc��tjdd�}|j|jd�|j|jd�y)zy
        L{ThreadPool.min} and L{ThreadPool.max} are set to the values passed to
        L{ThreadPool.__init__}.
        ��N)r�
ThreadPool�assertEqual�min�max�r�pools  r�test_attributeszThreadPoolTests.test_attributesOs>��
�$�$�R��,��������2�&�������2�&rc���tjdd�}|j�|j|j�|jt
|j�d�tjdd�}|jt
|j�d�|j�|j|j�|jt
|j�d�y)zV
        L{ThreadPool.start} creates the minimum number of threads specified.
        rr��
N)rr7�start�
addCleanup�stopr8r�threadsr;s  r�
test_startzThreadPoolTests.test_startXs����$�$�Q��*���
�
������	�	�"�����T�\�\�*�A�.��$�$�Q��+������T�\�\�*�A�.��
�
������	�	�"�����T�\�\�*�A�.rc���tjdd�}|j�|j�|j	d�|jt
|j�d�y)z�
        L{ThreadPool.adjustPoolsize} only modifies the pool size and does not
        start new workers while the pool is not running.
        rr�N)rr7rArC�adjustPoolsizer8rrDr;s  r�test_adjustingWhenPoolStoppedz-ThreadPoolTests.test_adjustingWhenPoolStoppedgsO��
�$�$�Q��*���
�
���	�	�����A������T�\�\�*�A�.rc�~�tjdd�}|j�|j|j�|j|jg�d�}Gd�d�}|�}tj|�}tj|�}|j||�tj�}|j|j�|j|j��~~tj �|j#|��|j#|��y)z�
        Test that creating threads in the threadpool with application-level
        objects as arguments doesn't results in those objects never being
        freed, with the thread maintaining a reference to them as long as it
        exists.
        rrc��yr
r()�args r�workerz<ThreadPoolTests.test_threadCreationArguments.<locals>.worker�s��rc��eZdZy)�:ThreadPoolTests.test_threadCreationArguments.<locals>.DumbN�r$r%r&r(rr�DumbrO����rrQN)rr7rArBrCr8rD�weakref�ref�callInThreadr�Event�set�waitr,�gc�collect�assertIsNone)r�tprMrQ�unique�	workerRef�	uniqueRef�events        r�test_threadCreationArgumentsz,ThreadPoolTests.test_threadCreationArgumentsrs����
"�
"�1�a�
(��
���
������� �	
������R�(�	�	�	�����K�K��'�	��K�K��'�	�	�����'����!��
����	�	�"�
�
�
�4�?�?�$�%���
�
�
�����)�+�&����)�+�&rc�������	�
���tjdd�}|j��j|j��j|jg�i�	tj��tj��g�
���	�
���fd�}�fd�}Gd�d����}tj|�}tj|��tj|��|j||||��~~�j��j�j��tj ��j#����j#���~tj ��j#|���j#�
d���jt%�	j'��ddg�y)	ze
        As C{test_threadCreationArguments} above, but for
        callInThreadWithCallback.
        rrc���tj��j�j�����d<���d<�j	��jt
j|��y)Nr^r_)rYrZrXr,rWr!rSrT)	�success�result�onResultDone�onResultWait�refdict�	resultRefrr_r^s	  �������r�onResultzVThreadPoolTests.test_threadCreationArgumentsCallInThreadWithCallback.<locals>.onResult�s^���
�J�J�L����d�o�o�/�0�#,�;�G�K� �#,�;�G�K� ��������W�[�[��0�1rc�����Sr
r()rL�testrQs  �rrMzTThreadPoolTests.test_threadCreationArgumentsCallInThreadWithCallback.<locals>.worker�s
����6�Mrc��eZdZy)�RThreadPoolTests.test_threadCreationArgumentsCallInThreadWithCallback.<locals>.DumbNrPr(rrrQrn�rRrrQ)rlN)rr7rArBrCr8rDrrVrSrT�callInThreadWithCallbackrWrXr,rYrZr[�list�values)
rr\rjrMr]�onResultRefrQrfrgrhrir_r^s
`     @@@@@@@r�4test_threadCreationArgumentsCallInThreadWithCallbackzDThreadPoolTests.test_threadCreationArgumentsCallInThreadWithCallback�sw����
"�
"�1�a�
(��
���
������� �	
������R�(��� ���(�� ���(���	�	2�	2�	�	�	�����k�k�(�+���K�K��'�	��K�K��'�	�	�#�#�H�f�f�6�#�J���	�������$�/�/�+�,�
�
�
�����)�+�&����)�+�&�
�
�
�
�����+�-�(����,�)�A�,�.�)�	
����g�n�n�.�/�$���>rc�`�tjdd�}|j|jd�|j|jd�tjtj|��}|j|jd�|j|jd�y)z�
        Threadpools can be pickled and unpickled, which should preserve the
        number of threads and other parameters.
        ��N)rr7r8r9r:�pickle�loads�dumps)rr<�copys   r�test_persistencez ThreadPoolTests.test_persistence�s��
�$�$�Q��+��������1�%�������2�&��|�|�F�L�L��.�/��������1�%�������2�&rc��d}tj�}|j�|j|j�tj�}|j�t||�}t|�D]}|||��
|j|�|j|jd|j�d��y)z�
        Test synchronization of calls made with C{method}, which should be
        one of the mechanisms of the threadpool to execute work in threads.
        r@zrun() re-entered z timesN)
rr7rArBrCrrrrr/r3�assertFalser )r�methodrr\r�actorr2s       r�_threadpoolTestzThreadPoolTests._threadpoolTest�s���
��
�
"�
"�
$��
���
������� ��.�.�"��������7�+���q��	�A��2�u��	�	
���'�"�������+<�U�^�^�<L�F�)S�Trc�&�|jd��S)z?
        Call C{_threadpoolTest} with C{callInThread}.
        c�8�|j|j�Sr
)rUr#)r\rs  r�<lambda>z3ThreadPoolTests.test_callInThread.<locals>.<lambda>s��b�o�o�e�i�i�6P�r)r�r"s r�test_callInThreadz!ThreadPoolTests.test_callInThreads���#�#�$P�Q�Qrc���Gd�dt���fd�}tjdd�}|j|�|j	�|j�|j
��}|jt|�d�y)zi
        L{ThreadPool.callInThread} logs exceptions raised by the callable it
        is passed.
        c��eZdZy)�<ThreadPoolTests.test_callInThreadException.<locals>.NewErrorNrPr(rr�NewErrorr�rRrr�c������r
r(�r�s�r�
raiseErrorz>ThreadPoolTests.test_callInThreadException.<locals>.raiseError�����*�rrrN)	�	Exceptionrr7rUrArC�flushLoggedErrorsr8r)rr�r\�errorsr�s    @r�test_callInThreadExceptionz*ThreadPoolTests.test_callInThreadExceptionsj���	�y�	�	��
"�
"�1�a�
(��
���
�#�
���
�
���	��'�'��1������V��a�(rc����tj���j�g���fd�}tjdd�}|j|d��|j
�	|j��|j�|j�d�|j�dd�y#|j�wxYw)z�
        L{ThreadPool.callInThreadWithCallback} calls C{onResult} with a
        two-tuple of C{(True, result)} where C{result} is the value returned
        by the callable supplied.
        c�j���j��j|��j|�yr
�rr!�rdre�results�waiters  ��rrjz?ThreadPoolTests.test_callInThreadWithCallback.<locals>.onResult5�%����N�N���N�N�7�#��N�N�6�"rrrc��y)Nrlr(r(rrr�z?ThreadPoolTests.test_callInThreadWithCallback.<locals>.<lambda>;��rrlN)rrrrr7rorAr3rC�
assertTruer8)rrjr\r�r�s   @@r�test_callInThreadWithCallbackz-ThreadPoolTests.test_callInThreadWithCallback*s�������!��������	#�
�
"�
"�1�a�
(��
�#�#�H�n�=�
���
�	����f�%��G�G�I������
�#�������V�,��
�G�G�I�s�)B4�4Cc�&����Gd�dt���fd�}tj���j�g���fd�}t	j
dd�}|j
||�|j�	|j��|j�|j�d�|j�dtj�|jt�dj ���y#|j�wxYw)z�
        L{ThreadPool.callInThreadWithCallback} calls C{onResult} with a
        two-tuple of C{(False, failure)} where C{failure} represents the
        exception raised by the callable supplied.
        c��eZdZy)�RThreadPoolTests.test_callInThreadWithCallbackExceptionInCallback.<locals>.NewErrorNrPr(rrr�r�MrRrr�c������r
r(r�s�rr�zTThreadPoolTests.test_callInThreadWithCallbackExceptionInCallback.<locals>.raiseErrorPr�rc�j���j��j|��j|�yr
r�r�s  ��rrjzRThreadPoolTests.test_callInThreadWithCallbackExceptionInCallback.<locals>.onResultXr�rrrN)r�rrrrr7rorAr3rCr}�assertIsInstancer�Failurer��
issubclass�type)rr�rjr\r�r�r�s    @@@r�0test_callInThreadWithCallbackExceptionInCallbackz@ThreadPoolTests.test_callInThreadWithCallbackExceptionInCallbackFs����	�y�	�	����!��������	#�
�
"�
"�1�a�
(��
�#�#�H�j�9�
���
�	����f�%��G�G�I�������$����g�a�j�'�/�/�:����
�7�1�:�?�?�H�=�>��	
�G�G�I�s�=C>�>Dc�<���Gd�dt��tj�}|j�g���fd�}t	j
dd�}|j
|d��|j|j�|j�	|j|�|j�|j��}|jt|�d�|j�d�|j!�d�y#|j�wxYw)zj
        L{ThreadPool.callInThreadWithCallback} logs the exception raised by
        C{onResult}.
        c��eZdZy)�RThreadPoolTests.test_callInThreadWithCallbackExceptionInOnResult.<locals>.NewErrorNrPr(rrr�r�prRrr�c�V���j|��j|����r
)r!)rdrer�r�s  ��rrjzRThreadPoolTests.test_callInThreadWithCallbackExceptionInOnResult.<locals>.onResultxs#����N�N�7�#��N�N�6�"��*�rrrc��yr
r(r(rrr�zRThreadPoolTests.test_callInThreadWithCallbackExceptionInOnResult.<locals>.<lambda>~r�rN)r�rrrrr7rorUrrAr3rCr�r8rr�r[)rr�rjr\r�r�r�s     @@r�0test_callInThreadWithCallbackExceptionInOnResultz@ThreadPoolTests.test_callInThreadWithCallbackExceptionInOnResultjs����	�y�	����!��������	�
�
"�
"�1�a�
(��
�#�#�H�l�;�
������'�
���
�	����f�%��G�G�I��'�'��1������V��a�(������
�#����'�!�*�%��

�G�G�I�s�D	�	Dc����g�tj����fd�}�fd�}tjdd�}|j	||�|j�|j
|j��j|j��|jt��d�|j�d�d�y)z�
        L{ThreadPool.callInThreadWithCallback} calls the function it is
        given and the C{onResult} callback in the same thread.
        c����jtj�j��j	�yr
)r!r�current_thread�identrW)rdrer`�	threadIdss  ��rrjz5ThreadPoolTests.test_callbackThread.<locals>.onResult�s)������Y�5�5�7�=�=�>��I�I�Krc�`���jtj�j�yr
)r!rr�r�)r�s�r�funcz1ThreadPoolTests.test_callbackThread.<locals>.func�s ������Y�5�5�7�=�=�>rrrrGN)rrVrr7rorArBrCrXr,r8r)rrjr�r\r`r�s    @@r�test_callbackThreadz#ThreadPoolTests.test_callbackThread�s����
�	����!��	�	?��
"�
"�1�a�
(��
�#�#�H�d�3�
���
������� �
�
�
�4�?�?�$�%�����Y���+�����1��y��|�4rc����tjj�jd}d|d<g�t	j
����fd�}�fd�}t
jdd�}|j||�|j�|j|j��j|j��|jt��d�|j|�d�|j|�d�y	)
z�
        The context L{ThreadPool.callInThreadWithCallback} is invoked in is
        shared by the context the callable and C{onResult} callback are
        invoked in.
        ���zthis must be present�testingc���tjj�jd}�j	|��j�y�Nr�)r�theContextTracker�currentContext�contextsr!rW)rdre�ctxr�r`s   ��rrjz6ThreadPoolTests.test_callbackContext.<locals>.onResult�s7����+�+�:�:�<�E�E�b�I�C��O�O�C� ��I�I�Krc�~��tjj�jd}�j	|�yr�)rr�r�r�r!)r�r�s �rr�z2ThreadPoolTests.test_callbackContext.<locals>.func�s.����+�+�:�:�<�E�E�b�I�C��O�O�C� rrrrGN)rr�r�r�rrVrr7rorArBrCrXr,r8r)r�myctxrjr�r\r�r`s     @@r�test_callbackContextz$ThreadPoolTests.test_callbackContext�s�����)�)�8�8�:�C�C�B�G��1��i�������!��	�
	!��
"�
"�1�a�
(��
�#�#�H�d�3�
���
������� �
�
�
�4�?�?�$�%�����X���*��������,��������,rc�<�tj�}|j�tjdd�}|j|j�|j�	|j|�|j�y#|j�wxYw)z�
        Work added to the threadpool before its start should be executed once
        the threadpool is started: this is ensured by trying to release a lock
        previously acquired.
        rrN)
rrrrr7rUrrAr3rC)rr�r\s   r�test_existingWorkz!ThreadPoolTests.test_existingWork�sk�����!������
�
"�
"�1�a�
(��
������'�
���
�	����f�%��G�G�I��B�G�G�I�s�'B	�	Bc����tjdd�}|j�|j|j�|j|jd�|jt|j�d�|jt|j�d�tj��tj����fd�}|j|��jd�|j|jd�|jt|j�d�|jt|j�d��j�t|j�s+tj d�t|j�s�+|jt|j�d�|jt|j�d�y)z{
        As the worker receives and completes work, it transitions between
        the working and waiting states.
        rrc�H���j��jd�y)Nr@)rWrX)�threadFinish�
threadWorkings��r�_threadz;ThreadPoolTests.test_workerStateTransition.<locals>._thread�s����������b�!rr@g����Mb@?N)rr7rArBrCr8�workersr�waiters�workingrrVrUrXrWrr)rr<r�r�r�s   @@r�test_workerStateTransitionz*ThreadPoolTests.test_workerStateTransition�sc���
�$�$�Q��*���
�
������	�	�"�	
������q�)�����T�\�\�*�A�.�����T�\�\�*�A�.�"���)�
� ���(��	"�	
���'�"����2��������q�)�����T�\�\�*�A�.�����T�\�\�*�A�.�	�����d�l�l�#��J�J�v���d�l�l�#�	
����T�\�\�*�A�.�����T�\�\�*�A�.rNc��tjdd�}|j|jj	�d�y)zB
        There is a property '_queue' for legacy purposes
        rrN)rr7r8�_queue�qsizer;s  r�test_qzThreadPoolTests.test_q�s3���$�$�Q��*��������*�*�,�a�0r)�returnN)r$r%r&�__doc__r,r3r=rErIrarsr{r�r�r�r�r�r�r�r�r�r�r�r(rrr*r*;so����?�'�
/�	/�('�TH?�T'� U�4R�)�(-�8"?�H!&�F5�2-�B�$#/�J1rr*c��eZdZd�Zd�Zd�Zy)�RaceConditionTestsc����tjdd��_tj��_�jj��fd�}�j
|�y)Nrr@c�>���jj��`yr
)rrCr"s�r�donez&RaceConditionTests.setUp.<locals>.dones����O�O� � �"��r)rr7rrVr`rArB)rr�s` r�setUpzRaceConditionTests.setUpsH���$�/�/��2�6����_�_�&��
�������	 �	
����rc��y)z=
        A reasonable number of seconds to time out.
        rr(r"s rr,zRaceConditionTests.getTimeoutr-rc��|j�}|jj|jj�|jj|�|jj
�td�D]1}|jj|jj
��3|jj|jj�|jj|�|jj�s,|jj	�|jd�yy)a�
        If multiple threads are waiting on an event (via blocking on something
        in a callable passed to L{threadpool.ThreadPool.callInThread}), and
        there is spare capacity in the threadpool, sending another callable
        which will cause those to un-block to
        L{threadpool.ThreadPool.callInThread} will reliably run that callable
        and un-block the blocked threads promptly.

        @note: This is not really a unit test, it is a stress-test.  You may
            need to run it with C{trial -u} to fail reliably if there is a
            problem.  It is very hard to regression-test for this particular
            bug - one where the thread pool may consider itself as having
            "enough capacity" when it really needs to spin up a new thread if
            it possibly can - in a deterministic way, since the bug can only be
            provoked by subtle race conditions.
        r?z9'set' did not run in thread; timed out waiting on 'wait'.N)
r,rrUr`rWrX�clearr/�isSetr0)r�timeoutr2s   r�test_synchronizationz'RaceConditionTests.test_synchronizations���"�/�/�#�����$�$�T�Z�Z�^�^�4��
�
���� ��
�
�����q��	:�A��O�O�(�(������9�	:����$�$�T�Z�Z�^�^�4��
�
���� ��z�z���!��J�J�N�N���I�I�Q�R�"rN)r$r%r&r�r,r�r(rrr�r�s��	��Srr�c��eZdZdZd�Zd�Zy)�
MemoryPoolz
    A deterministic threadpool that uses in-memory data structures to queue
    work rather than threads to execute work.
    c�t�||_||_||_tjj
|g|��i|��y)a�
        Initialize this L{MemoryPool} with a test case.

        @param coordinator: a worker used to coordinate work in the L{Team}
            underlying this threadpool.
        @type coordinator: L{twisted._threads.IExclusiveWorker}

        @param failTest: A 1-argument callable taking an exception and raising
            a test-failure exception.
        @type failTest: 1-argument callable taking (L{Failure}) and raising
            L{unittest.FailTest}.

        @param newWorker: a 0-argument callable that produces a new
            L{twisted._threads.IWorker} provider on each invocation.
        @type newWorker: 0-argument callable returning
            L{twisted._threads.IWorker}.
        N)�_coordinator�	_failTest�
_newWorkerrr7r)r�coordinator�failTest�	newWorker�args�kwargss      rrzMemoryPool.__init__<s8��$(���!���#������&�&�t�=�d�=�f�=rc�^�������fd�}t�j|�j����S)a�
        Override testing hook to create a deterministic threadpool.

        @param currentLimit: A 1-argument callable which returns the current
            threadpool size limit.

        @param threadFactory: ignored in this invocation; a 0-argument callable
            that would produce a thread.

        @return: a L{Team} backed by the coordinator and worker passed to
            L{MemoryPool.__init__}.
        c����j�}|j|jz��k\ry�j�Sr
)�
statistics�busyWorkerCount�idleWorkerCountr�)�stats�currentLimitr�teams ���r�respectLimitz&MemoryPool._pool.<locals>.respectLimitas<����O�O�%�E��%�%��(=�(=�=�,�.�P���?�?�$�$r)r��createWorker�logException)rr�r�)rr��
threadFactoryr�r�s``  @r�_poolzMemoryPool._poolSs.���	%���)�)�%����
��
�rN)r$r%r&r�rr�r(rrr�r�6s���
>�.rr�c��eZdZdZd�Zd�Zy)�
PoolHelpera
    A L{PoolHelper} constructs a L{threadpool.ThreadPool} that doesn't actually
    use threads, by using the internal interfaces in L{twisted._threads}.

    @ivar performCoordination: a 0-argument callable that will perform one unit
        of "coordination" - work involved in delegating work to other threads -
        and return L{True} if it did any work, L{False} otherwise.

    @ivar workers: the workers which represent the threads within the pool -
        the workers other than the coordinator.
    @type workers: L{list} of 2-tuple of (L{IWorker}, C{workPerformer}) where
        C{workPerformer} is a 0-argument callable like C{performCoordination}.

    @ivar threadpool: a modified L{threadpool.ThreadPool} to test.
    @type threadpool: L{MemoryPool}
    c���t�\}�_g�_�fd�}t||j|g|��i|���_y)z�
        Create a L{PoolHelper}.

        @param testCase: a test case attached to this helper.

        @type args: The arguments passed to a L{threadpool.ThreadPool}.

        @type kwargs: The arguments passed to a L{threadpool.ThreadPool}
        c�n���jjt���jddS)Nr�r)r�r!rr"s�rr�z&PoolHelper.__init__.<locals>.newWorker�s-����L�L��� 2� 4�5��<�<��#�A�&�&rN)r�performCoordinationr�r�r0r)r�testCaser�r�r�r�s`     rrzPoolHelper.__init__�sK���1C�0D�-��T�-����	'�%�����	�
�48�
�<B�
��rc�J�|j�r	|j�r�yy)z�
        Perform all currently scheduled "coordination", which is the work
        involved in delegating work to other threads.
        N)r�r"s r�performAllCoordinationz!PoolHelper.performAllCoordination�s!��
�&�&�(���&�&�(rN)r$r%r&r�rr�r(rrr�r�rs���"
�*rr�c��eZdZdZd�Zd�Zy)�MemoryBackedTestszn
    Tests using L{PoolHelper} to deterministically test properties of the
    threadpool implementation.
    c�p�t|dd�}d}t|�D]}|jjd��� |j	�|j|jg�|jj�|j	�|jt|j�|�y)z�
        If a threadpool is told to do work before starting, then upon starting
        up, it will start enough workers to handle all of the enqueued work
        that it's been given.
        rr@rc��yr
r(r(rrr�z;MemoryBackedTests.test_workBeforeStarting.<locals>.<lambda>�r�rN)	r�r/rrUr�r8r�rAr�r�helper�n�xs    r�test_workBeforeStartingz)MemoryBackedTests.test_workBeforeStarting�s����D�!�R�(��
���q��	9�A����*�*�<�8�	9��%�%�'��������,������!��%�%�'�����V�^�^�,�a�0rc��t|dd�}d}t|�D]}|jjd��� |j	�|j|jg�|jj�|j	�|jt|j�|jj�y)z�
        If the amount of work before starting exceeds the maximum number of
        threads allowed to the threadpool, only the maximum count will be
        started.
        rr@�2c��yr
r(r(rrr�zBMemoryBackedTests.test_tooMuchWorkBeforeStarting.<locals>.<lambda>�r�rN)
r�r/rrUr�r8r�rArr:rs    r�test_tooMuchWorkBeforeStartingz0MemoryBackedTests.test_tooMuchWorkBeforeStarting�s����D�!�R�(�����q��	9�A����*�*�<�8�	9��%�%�'��������,������!��%�%�'�����V�^�^�,�f�.?�.?�.C�.C�DrN)r$r%r&r�rr	r(rrr�r��s���
1� Err�)r�rYrwrrrS�twisted._threadsrr�twisted.pythonrrrr�
twisted.trialr	r�synchronize�SynchronousTestCaser*r�r7r�r�r�r(rr�<module>rs����

�
����5�C�C�"�!�!�H�
����'�H1�h�2�2�H1�V-S��5�5�-S�`9��&�&�9�x-�-�`$E��4�4�$Er
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!