<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Class Threading - Class Threading</title> <link href="faldoc.css" rel="stylesheet" type="text/css"/> <link href="tabs.css" rel="stylesheet" type="text/css"/> </head> <body class="faldoc_body"> <div class="navitop"> <div class="tabs"> <ul> <li><a href="./index.html"><span>Main</span></a></li> <li><a href="./modules.html"><span>Modules</span></a></li> <li><a href="./pages.html"><span>Related pages</span></a></li> <li><a href="./groups.html"><span>Groups</span></a></li> <li><a href="./classes.html"><span>Classes</span></a></li> <li><a href="./objects.html"><span>Objects</span></a></li> <li><a href="./functions.html"><span>All functions</span></a></li> <li><a href="./enum.html"><span>Enumerations</span></a></li> </ul> </div> </div> <hr/> <h1 class="faldoc_title">Class Threading<span class="faldoc_belong"><a href="./module_feathers_threading.html">[in Threading]</a></p></h1> <p class="faldoc_brief">Access to static method that can be used to access threading functionalities. </p> <p class="faldoc_funcdecl"> <b>class</b> Threading </p> <p class="faldoc_brief"><a href="#more">more...</a></p> <h2 class="faldoc_title">Summary</h2> <table class="faldoc_list"> <tr><td><a href="#getCurrent">getCurrent()</a></td><td>Returns a Thread object built on the current system thread. </td></tr> <tr><td><a href="#getCurrentID">getCurrentID()</a></td><td>Returns the current thread ID. </td></tr> <tr><td><a href="#sameThread">sameThread()</a></td><td>Returns true if the given thread refers to the running system thread. </td></tr> <tr><td><a href="#start">start()</a></td><td>Starts a new thread and instructs it to execute the given callable item. </td></tr> <tr><td><a href="#vwait">vwait()</a></td><td>Wait for one or more synchronization strucures to become available. </td></tr> <tr><td><a href="#wait">wait()</a></td><td>Wait for one or more synchronization strucures to become available. </td></tr> </table> <a name="more"><h2 class="faldoc_title">Detailed description</h2></a> <p class="faldoc_funcdecl"> <b>class</b> Threading </p> <table class="faldoc_function"> </table> <br/> <p class="item_brief">Access to static method that can be used to access threading functionalities. </p> <p class="faldoc_text"> This class offers a namespace for generic methods provided by the Threading module. The mehods in this class are all static and can be directly called by items not derived from the <a href="./class_Thread.html">Thread</a> class to gain access to multithread functionalities. </p> <h2 class="faldoc_title">Methods</h2> <h3 class="faldoc_funcname"><a name="getCurrent">getCurrent()</a></h3> <p class="item_brief">Returns a Thread object built on the current system thread. </p> <p class="faldoc_funcdecl">Threading.getCurrent( )</p> <table class="faldoc_function"> <tr><td class="faldoc_funcreturn">Returns:</td><td class="faldoc_funcreturndesc"> A new instance of <a href="./class_Thread.html">Thread</a>. </td></tr> </table> <p class="faldoc_text"><p class="faldoc_text"> This method creates an instance of the <a href="./class_Thread.html">Thread</a> class referencing the current system thread. The returned object can then be shared, sent to other threads or used directly to control thraead execution. </p> </p> <h3 class="faldoc_funcname"><a name="getCurrentID">getCurrentID()</a></h3> <p class="item_brief">Returns the current thread ID. </p> <p class="faldoc_funcdecl">Threading.getCurrentID( )</p> <table class="faldoc_function"> <tr><td class="faldoc_funcreturn">Returns:</td><td class="faldoc_funcreturndesc">A numeric ID uniquely identifying the current thread. </td></tr> </table> <h3 class="faldoc_funcname"><a name="sameThread">sameThread()</a></h3> <p class="item_brief">Returns true if the given thread refers to the running system thread. </p> <p class="faldoc_funcdecl">Threading.sameThread( thread )</p> <table class="faldoc_function"> <tr><td class="faldoc_param">thread</td><td class="faldoc_paramdesc"> Instance of the <a href="./class_Thread.html">Thread</a> class to be compared. </td></tr> <tr><td class="faldoc_funcreturn">Returns:</td><td class="faldoc_funcreturndesc"> True if <b>thread</b> is referencing the currently running thread. </td></tr> </table> <h3 class="faldoc_funcname"><a name="start">start()</a></h3> <p class="item_brief">Starts a new thread and instructs it to execute the given callable item. </p> <p class="faldoc_funcdecl">Threading.start( callable )</p> <table class="faldoc_function"> <tr><td class="faldoc_param">callable</td><td class="faldoc_paramdesc">A Falcon callable item. </td></tr> <tr><td class="faldoc_raise">Raises:</td><td class="faldoc_raisedesc"> <table class="faldoc_raise"> <tr><td class="faldoc_raiseitem"><a href="./class_ThreadError.html">ThreadError</a></td><td class="faldoc_raisedesc">if the given object is not callable. </td></tr> </table> </td></tr> </table> <p class="faldoc_text"><p class="faldoc_text"> This method works as <a href="./class_Thread.html#run">Thread.run</a>, but instead requiring a <a href="./class_Thread.html">Thread</a> class instance (or an instance of a derived class), it can start execution of an arbitrary symbol, including a method of a totally unrelated class. </p> <p class="faldoc_text">In example: </p> <pre class="faldoc_code"> function thread_a( sync, data ) ... end class MyClass function thread_b( sync ) ... end end ... // sync and data are shareable structures Threading.start( .[thread_a sync data] ) myInst = MyClass() Threading.start( .[ myInst.thread_b sync data] ) </pre> </p> <h3 class="faldoc_funcname"><a name="vwait">vwait()</a></h3> <p class="item_brief">Wait for one or more synchronization strucures to become available. </p> <p class="faldoc_funcdecl">Threading.vwait( structArray, [waitTime] )</p> <table class="faldoc_function"> <tr><td class="faldoc_param">structArray</td><td class="faldoc_paramdesc">Array of structures to wait for </td></tr> <tr><td class="faldoc_optparam">waitTime</td><td class="faldoc_optparamdesc">Maximum timeout in seconds and fractions. </td></tr> <tr><td class="faldoc_funcreturn">Returns:</td><td class="faldoc_funcreturndesc"> nil if timeout expires, an ID in the <b>structArray</b> or the acquired structure. </td></tr> <tr><td class="faldoc_raise">Raises:</td><td class="faldoc_raisedesc"> <table class="faldoc_raise"> <tr><td class="faldoc_raiseitem"><b><i>InterrutpedError</i></b></td><td class="faldoc_raisedesc">in case the thread receives a stop request. </td></tr> </table> </td></tr> </table> <p class="faldoc_text"><p class="faldoc_text"> This method waits for one of the structures in the given <b>structArray</b> to become acquireable, and acquires it before returning. </p> <p class="faldoc_text"> This works exactly as <a href="./class_Threading.html#wait">Threading.wait</a>, but, on success, the method returns the ID of the acquired item in <b>structArray</b> rather than the object itself. In this way, it is possible to rotate or change the list of items on which to wait for at each call. </p> </p> <h3 class="faldoc_funcname"><a name="wait">wait()</a></h3> <p class="item_brief">Wait for one or more synchronization strucures to become available. </p> <p class="faldoc_funcdecl">Threading.wait( ..., [waitTime] )</p> <table class="faldoc_function"> <tr><td class="faldoc_param">...</td><td class="faldoc_paramdesc">One or more synchronization structure to wait for. </td></tr> <tr><td class="faldoc_optparam">waitTime</td><td class="faldoc_optparamdesc">Maximum timeout in seconds and fractions. </td></tr> <tr><td class="faldoc_funcreturn">Returns:</td><td class="faldoc_funcreturndesc">nil if timeout expires, or the acquired item on success. </td></tr> <tr><td class="faldoc_raise">Raises:</td><td class="faldoc_raisedesc"> <table class="faldoc_raise"> <tr><td class="faldoc_raiseitem"><b><i>InterrutpedError</i></b></td><td class="faldoc_raisedesc">in case the thread receives a stop request. </td></tr> </table> </td></tr> </table> <p class="faldoc_text"><p class="faldoc_text">This method waits for one of the structures in the given parameters to become acquireable, and acquires it before returning. </p> </p> <hr/> <div class="navibottom"> <center> <a href="./index.html">Main</a> - <a href="./modules.html">Modules</a> - <a href="./pages.html">Related pages</a> - <a href="./groups.html">Groups</a> - <a href="./classes.html">Classes</a> - <a href="./objects.html">Objects</a> - <a href="./functions.html">All functions</a> - <a href="./enum.html">Enumerations</a> </center> </div> </div> <div class="faldoc_signature">Made with <a href="http://www.falconpl.org">faldoc 2.2.0</div> </body> </html>