From 8f39b7df4f3f6167615f353ad5e895535577689b Mon Sep 17 00:00:00 2001 From: Prodesire Date: Thu, 26 Oct 2017 22:54:11 +0800 Subject: [PATCH] add doc for unix_timeout --- docs/index.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index 1bdc65e..196076f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -190,6 +190,24 @@ String Miscellanea ----------- +.. function:: pydu.utils.unix_timeout(seconds) + + This func decorates any func which may be hang for a while. The param `seconds` + should be integer. `unix_timeout` can only be used on unix-like system. + In `test.py`, you may write like below: + + .. code-block:: python + + import time + from pydu.utils import unix_timeout + @unix_timeout(1) + def f(): + time.sleep(1.01) + f() + + Ant run `test.py`, will see `TimeoutError` + + .. function:: pydu.utils.trace(obj) Tracing every statement and line number for running program, like `bash -x`.