
    |@h1	                     B    d Z ddlZddlZ G d dej                        Zy)zIEnhanced Thread with support for return values and exception propagation.    Nc                   0    e Zd ZdZddZd Zd Zd Zd Zy)	REThreadzThread with return values and exception propagation.

    The thread is marked as daemon thread. The entire Python program exits
    when no alive non-daemon threads are left.
    Nc           	          |i }t         j                  j                  | |||||d       || _        || _        || _        d| _        d| _        y)z<Initialize Thread, identical to threading.Thread.__init__().NT)daemon)	threadingThread__init___REThread__target_REThread__args_REThread__kwargs_retval
_exception)selfgrouptargetnameargskwargss         1/usr/lib/python3/dist-packages/apport/REThread.pyr	   zREThread.__init__   sS    >F!!$vtT6RV!W    c                     | j                   r-	  | j                   | j                  i | j                  | _        yy# t        $ r$ t
        rt        j                         | _        Y yY yw xY w)z9Run target function, identical to threading.Thread.run().N)r
   r   r   r   BaseExceptionsysexc_infor   r   s    r   runzREThread.run&   sX    ==5,t}}dkkKT]]K  ! 5&)llnDO 5s   +; (A('A(c                 Z    | j                         rJ | j                  rJ | j                  S )zReturn value from target function.

        This can only be called after the thread has finished, i. e. when
        is_alive() is False and did not terminate with an exception.
        )is_aliver   r   r   s    r   return_valuezREThread.return_value/   s*     ==?""??""||r   c                     | j                   S )zAReturn (type, value, traceback) of the exception caught in run().)r   r   s    r   r   zREThread.exc_info9   s    r   c                 r    | j                   r+| j                   d   j                  | j                   d         y)zbRaise the exception caught in the thread.

        Do nothing if no exception was caught.
              N)r   with_tracebackr   s    r   	exc_raisezREThread.exc_raise=   s3    
 ??//!$33DOOA4FGG r   )NNN N)	__name__
__module____qualname____doc__r	   r   r   r   r%   r&   r   r   r   r      s!    
5Hr   r   )r*   r   r   r   r   r&   r   r   <module>r+      s$    O  0Hy 0Hr   