ó
ˆ5„Oc           @   s;   d  Z  d d l Z d d l Z d e j f d „  ƒ  YZ d S(   sI   Enhanced Thread with support for return values and exception propagation.iÿÿÿÿNt   REThreadc           B   sM   e  Z d  Z d d d d i  d d „ Z d „  Z d „  Z d „  Z d „  Z RS(   s4   Thread with return values and exception propagation.c         C   sS   t  j j |  | | | | | | ƒ | |  _ | |  _ | |  _ d |  _ d |  _ d S(   s<   Initialize Thread, identical to threading.Thread.__init__().N(	   t	   threadingt   Threadt   __init__t   _REThread__targett   _REThread__argst   _REThread__kwargst   Nonet   _retvalt
   _exception(   t   selft   groupt   targett   namet   argst   kwargst   verbose(    (    s3   /usr/lib/python2.7/dist-packages/apport/REThread.pyR      s    				c         C   sQ   |  j  rM y |  j  |  j |  j Ž  |  _ WqM t rJ t j ƒ  |  _ qJ qM Xn  d S(   s9   Run target function, identical to threading.Thread.run().N(   R   R   R   R   t   syst   exc_infoR	   (   R
   (    (    s3   /usr/lib/python2.7/dist-packages/apport/REThread.pyt   run   s    	c         C   s*   |  j  ƒ  s t ‚ |  j s# t ‚ |  j S(   sº   Return value from target function.

        This can only be called after the thread has finished, i. e. when
        isAlive() is False and did not terminate with an exception.
        (   t   isAlivet   AssertionErrorR	   R   (   R
   (    (    s3   /usr/lib/python2.7/dist-packages/apport/REThread.pyt   return_value'   s    c         C   s   |  j  S(   sA   Return (type, value, traceback) of the exception caught in run().(   R	   (   R
   (    (    s3   /usr/lib/python2.7/dist-packages/apport/REThread.pyR   1   s    c         C   s1   |  j  r- |  j  d |  j  d |  j  d ‚ n  d S(   sb   Raise the exception caught in the thread.

        Do nothing if no exception was caught.
        i    i   i   N(   R	   (   R
   (    (    s3   /usr/lib/python2.7/dist-packages/apport/REThread.pyt	   exc_raise6   s    	N(    (	   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   (    (    (    s3   /usr/lib/python2.7/dist-packages/apport/REThread.pyR       s   	
	
	(   R   R   R   R   R    (    (    (    s3   /usr/lib/python2.7/dist-packages/apport/REThread.pyt   <module>   s   