Current File : //usr/lib/python2.7/site-packages/vdo/utils/Timeout.pyc |
�
.�t_c @ sB d Z d d l Z d e f d � � YZ d e f d � � YZ d S( s�
Timeout - context manager that implements a timeout.
$Id: //eng/vdo-releases/magnesium/src/python/vdo/utils/Timeout.py#1 $
i����Nt TimeoutErrorc B s# e Z d Z d d � Z d � Z RS( s( Exception raised when a block times out.c O s; t t | � j | | � | d k r. d } n | | _ d S( Nt timeout( t superR t __init__t Nonet _msg( t selft msgt argst kwargs( ( s5 /usr/lib/python2.7/site-packages/vdo/utils/Timeout.pyR s c C s | j S( N( R ( R ( ( s5 /usr/lib/python2.7/site-packages/vdo/utils/Timeout.pyt __str__% s N( t __name__t
__module__t __doc__R R R
( ( ( s5 /usr/lib/python2.7/site-packages/vdo/utils/Timeout.pyR s t Timeoutc B s5 e Z d Z d � Z d � Z d d � Z d � Z RS( s� Context manager for running a block of commands under a timeout.
If the block times out, a TimeoutError is raised.
Arguments:
seconds (int) - timeout in seconds
msg (str) - message to supply to TimeoutError
c s5 t j t j � f d � � � _ t j � j � � S( Nc s
� j � S( N( t _timeout( t _signumt _frame( R ( s5 /usr/lib/python2.7/site-packages/vdo/utils/Timeout.pyt <lambda>; s ( t signalt SIGALRMt _Timeout__oldHandlert alarmt _Timeout__seconds( R ( ( R s5 /usr/lib/python2.7/site-packages/vdo/utils/Timeout.pyt __enter__8 s c C s'