pydoc
This commit is contained in:
parent
f21d4b4b49
commit
0e43f0b161
@ -19,10 +19,8 @@ LICENSE, otherwise it is available at https://gith
|
||||
|
||||
<tr ><td bgcolor="#aa55cc" ><tt > </tt></td><td > </td>
|
||||
<td width="100%" ><table width="100%" summary="list" ><tr ><td width="25%" valign="top" ><a href="ctypes.html" >ctypes</a><br />
|
||||
<a href="os.html" >os</a><br />
|
||||
</td><td width="25%" valign="top" ><a href="sys.html" >sys</a><br />
|
||||
<a href="threading.html" >threading</a><br />
|
||||
</td><td width="25%" valign="top" ><a href="time.html" >time</a><br />
|
||||
</td><td width="25%" valign="top" ><a href="os.html" >os</a><br />
|
||||
</td><td width="25%" valign="top" ><a href="threading.html" >threading</a><br />
|
||||
</td><td width="25%" valign="top" ></td></tr></table></td></tr></table><p >
|
||||
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section" >
|
||||
<tr bgcolor="#ee77aa" >
|
||||
@ -46,7 +44,12 @@ LICENSE, otherwise it is available at https://gith
|
||||
<font color="#000000" face="helvetica, arial" ><a name="JoinThread" >class <strong >JoinThread</strong></a>(<a href="threading.html#Thread" >threading.Thread</a>)</font></td></tr>
|
||||
|
||||
<tr bgcolor="#ffc8d8" ><td rowspan="2" ><tt > </tt></td>
|
||||
<td colspan="2" ><tt ><a href="#JoinThread" >JoinThread</a> - The workhouse that stops the <a href="#StoppableThread" >StoppableThread</a><br /> </tt></td></tr>
|
||||
<td colspan="2" ><tt ><a href="#JoinThread" >JoinThread</a> - The workhouse that stops the <a href="#StoppableThread" >StoppableThread</a>.<br />
|
||||
<br />
|
||||
Takes an exception, and upon being started immediately raises that exception in the current context<br />
|
||||
of the thread's execution (so next line of python gets it, or next call to a python api function in C code ).<br />
|
||||
<br />
|
||||
@see <a href="#StoppableThread" >StoppableThread</a> for more details<br /> </tt></td></tr>
|
||||
<tr ><td > </td>
|
||||
<td width="100%" ><dl ><dt >Method resolution order:</dt>
|
||||
<dd ><a href="func_timeout.StoppableThread.html#JoinThread" >JoinThread</a></dd>
|
||||
@ -55,32 +58,18 @@ LICENSE, otherwise it is available at https://gith
|
||||
</dl>
|
||||
<hr />
|
||||
Methods defined here:<br />
|
||||
<dl ><dt ><a name="JoinThread-__init__" ><strong >__init__</strong></a>(self, otherThread, exception, repeatEvery=2.0)</dt><dd ><tt >This constructor should always be called with keyword arguments. Arguments are:<br />
|
||||
<dl ><dt ><a name="JoinThread-__init__" ><strong >__init__</strong></a>(self, otherThread, exception, repeatEvery=2.0)</dt><dd ><tt >__init__ - Create a <a href="#JoinThread" >JoinThread</a> (don't forget to call .<a href="#JoinThread-start" >start</a>() ! )<br />
|
||||
<br />
|
||||
*group* should be None; reserved for future extension when a ThreadGroup<br />
|
||||
class is implemented.<br />
|
||||
@param otherThread <threading.<a href="threading.html#Thread" >Thread</a>> - A thread<br />
|
||||
<br />
|
||||
*target* is the callable object to be invoked by the <a href="#JoinThread-run" >run</a>()<br />
|
||||
method. Defaults to None, meaning nothing is called.<br />
|
||||
@param exception <BaseException> - An exception. Should be a BaseException, to prevent "catch Exception as e: continue" type code<br />
|
||||
from never being terminated. If such code is unavoidable, you can try setting #repeatEvery to a very low number, like .00001,<br />
|
||||
and it will hopefully raise within the context of the catch, and be able to break free.<br />
|
||||
<br />
|
||||
*name* is the thread name. By default, a unique name is constructed of<br />
|
||||
the form "<a href="threading.html#Thread" >Thread</a>-N" where N is a small decimal number.<br />
|
||||
<br />
|
||||
*args* is the argument tuple for the target invocation. Defaults to ().<br />
|
||||
<br />
|
||||
*kwargs* is a dictionary of keyword arguments for the target<br />
|
||||
invocation. Defaults to {}.<br />
|
||||
<br />
|
||||
If a subclass overrides the constructor, it must make sure to invoke<br />
|
||||
the base class constructor (<a href="threading.html#Thread" >Thread</a>.<a href="#JoinThread-__init__" >__init__</a>()) before doing anything<br />
|
||||
else to the thread.</tt></dd></dl>
|
||||
@param repeatEvery <float> Default 2.0 - After starting, the given exception is immediately raised. Then, every #repeatEvery seconds,<br />
|
||||
it is raised again, until the thread terminates.</tt></dd></dl>
|
||||
|
||||
<dl ><dt ><a name="JoinThread-run" ><strong >run</strong></a>(self)</dt><dd ><tt >Method representing the thread's activity.<br />
|
||||
<br />
|
||||
You may override this method in a subclass. The standard <a href="#JoinThread-run" >run</a>() method<br />
|
||||
invokes the callable object passed to the object's constructor as the<br />
|
||||
target argument, if any, with sequential and keyword arguments taken<br />
|
||||
from the args and kwargs arguments, respectively.</tt></dd></dl>
|
||||
<dl ><dt ><a name="JoinThread-run" ><strong >run</strong></a>(self)</dt><dd ><tt >run - The thread main. Will attempt to stop and join the attached thread.</tt></dd></dl>
|
||||
|
||||
<hr />
|
||||
Methods inherited from <a href="threading.html#Thread" >threading.Thread</a>:<br />
|
||||
@ -175,7 +164,24 @@ initial name is set by the constructor.</tt></dd>
|
||||
<font color="#000000" face="helvetica, arial" ><a name="StoppableThread" >class <strong >StoppableThread</strong></a>(<a href="threading.html#Thread" >threading.Thread</a>)</font></td></tr>
|
||||
|
||||
<tr bgcolor="#ffc8d8" ><td rowspan="2" ><tt > </tt></td>
|
||||
<td colspan="2" ><tt ><a href="#StoppableThread" >StoppableThread</a> - A thread that can be stopped by forcing an exception in the execution context.<br /> </tt></td></tr>
|
||||
<td colspan="2" ><tt ><a href="#StoppableThread" >StoppableThread</a> - A thread that can be stopped by forcing an exception in the execution context.<br />
|
||||
<br />
|
||||
This works both to interrupt code that is in C or in python code, at either the next call to a python function,<br />
|
||||
or the next line in python code.<br />
|
||||
<br />
|
||||
It is recommended that if you call stop ( @see <a href="#StoppableThread" >StoppableThread</a>.stop ) that you use an exception that inherits BaseException, to ensure it likely isn't caught.<br />
|
||||
<br />
|
||||
Also, beware unmarked exception handlers in your code. Code like this:<br />
|
||||
<br />
|
||||
while True:<br />
|
||||
try:<br />
|
||||
doSomething()<br />
|
||||
except:<br />
|
||||
continue<br />
|
||||
<br />
|
||||
will never be able to abort, because the exception you raise is immediately caught.<br />
|
||||
<br />
|
||||
The exception is raised over and over, with a specifed delay (default 2.0 seconds)<br /> </tt></td></tr>
|
||||
<tr ><td > </td>
|
||||
<td width="100%" ><dl ><dt >Method resolution order:</dt>
|
||||
<dd ><a href="func_timeout.StoppableThread.html#StoppableThread" >StoppableThread</a></dd>
|
||||
@ -184,7 +190,7 @@ initial name is set by the constructor.</tt></dd>
|
||||
</dl>
|
||||
<hr />
|
||||
Methods defined here:<br />
|
||||
<dl ><dt ><a name="StoppableThread-stop" ><strong >stop</strong></a>(self, exception)</dt><dd ><tt >Stops the thread by raising a given exception.<br />
|
||||
<dl ><dt ><a name="StoppableThread-stop" ><strong >stop</strong></a>(self, exception, raiseEvery=2.0)</dt><dd ><tt >Stops the thread by raising a given exception.<br />
|
||||
<br />
|
||||
@param exception <Exception> - Exception to throw. Likely, you want to use something<br />
|
||||
that inherits from BaseException (so except Exception as e: continue; isn't a problem)</tt></dd></dl>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user