Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > e3918135d52936bad0ecc8654eedea12 > files > 217

Falcon-doc-0.9.6.8-1.fc15.noarch.rpm

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" >
<head><meta content="text/html;charset=&amp;quot;utf-8&amp;quot;" http-equiv="Content-type"/><link href="faldoc.css" rel="stylesheet" type="text/css"/><title> - Class Threading</title></head><body class="faldoc"><ul class="navi_top"><li class="top"><a href="index.html">Top: Table of contents</a></li>
         <li class="up"><a href="feathers_threading.html">Up: Multithreading</a></li>
         <li class="prev"><a href="feathers_threading_ThreadError.html">Previous: Class ThreadError</a></li>
         <li class="next"><a href="feathers_threading_Waitable.html">Next: Class Waitable</a></li>
         <li class="clear"></li>
         </ul><div id="page_body"><h1><span class="toc_number">2.13.13</span>Class Threading</h1><p class="brief">Access to static method that can be used to access threading functionalities. </p>
         <pre class="prototype">Class Threading</pre>
         <p>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="feathers_threading_Thread.html">Thread</a> class to gain access to multithread functionalities. </p>
<table class="members">
         <tbody><tr class="member_type"><td class="member_type" colspan="2">Methods</td></tr>
               <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>
               </tbody>
            </table>
         <h2>Methods</h2><h3><a name="getCurrent">getCurrent</a></h3><p class="brief">Returns a Thread object built on the current system thread. </p>
         <pre class="prototype">Threading.getCurrent()</pre>
         <table class="prototype">
         <tbody><tr class="return"><td class="name">Return</td><td class="content">A new instance of <a href="feathers_threading_Thread.html">Thread</a>. </td></tr>
               </tbody>
            </table>
         <p>This method creates an instance of the <a href="feathers_threading_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>
<h3><a name="getCurrentID">getCurrentID</a></h3><p class="brief">Returns the current thread ID. </p>
         <pre class="prototype">Threading.getCurrentID()</pre>
         <table class="prototype">
         <tbody><tr class="return"><td class="name">Return</td><td class="content">A numeric ID uniquely identifying the current thread. </td></tr>
               </tbody>
            </table>
         <p class="see_also">See also: <a href="feathers_threading_Thread.html">Thread</a>.</p>
         <h3><a name="sameThread">sameThread</a></h3><p class="brief">Returns true if the given thread refers to the running system thread. </p>
         <pre class="prototype">Threading.sameThread( thread )</pre>
         <table class="prototype">
         <tbody><tr class="param"><td class="name">thread</td><td class="content"> Instance of the <a href="feathers_threading_Thread.html">Thread</a> class to be compared. </td></tr>
               <tr class="return"><td class="name">Return</td><td class="content">True if <b>thread</b> is referencing the currently running thread. </td></tr>
               </tbody>
            </table>
         <h3><a name="start">start</a></h3><p class="brief">Starts a new thread and instructs it to execute the given callable item. </p>
         <pre class="prototype">Threading.start( callable )</pre>
         <table class="prototype">
         <tbody><tr class="param"><td class="name">callable</td><td class="content"> A Falcon callable item. </td></tr>
               <tr class="raise"><td class="name">Raise</td><td class="content"><table>
                     <tbody><tr><td class="name"><a href="feathers_threading_ThreadError.html">ThreadError</a></td><td class="content"> if the given object is not callable. </td></tr>
                           </tbody>
                        </table>
                     </td></tr>
               </tbody>
            </table>
         <p>This method works as <a href="feathers_threading_Thread.html#run">Thread.run</a>, but instead requiring a <a href="feathers_threading_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>In example: </p>
<pre>

      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><h3><a name="vwait">vwait</a></h3><p class="brief">Wait for one or more synchronization strucures to become available. </p>
         <pre class="prototype">Threading.vwait( structArray, [waitTime] )</pre>
         <table class="prototype">
         <tbody><tr class="param"><td class="name">structArray</td><td class="content"> Array of structures to wait for </td></tr>
               <tr class="optparam"><td class="name">waitTime</td><td class="content"> Maximum timeout in seconds and fractions. </td></tr>
               <tr class="return"><td class="name">Return</td><td class="content">nil if timeout expires, an ID in the <b>structArray</b> or the acquired structure. </td></tr>
               <tr class="raise"><td class="name">Raise</td><td class="content"><table>
                     <tbody><tr><td class="name"><b>InterrutpedError</b></td><td class="content"> in case the thread receives a stop request. </td></tr>
                           </tbody>
                        </table>
                     </td></tr>
               </tbody>
            </table>
         <p>This method waits for one of the structures in the given <b>structArray</b> to become acquireable, and acquires it before returning. </p>
<p>This works exactly as <a href="feathers_threading_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 class="see_also">See also: <a href="feathers_threading_Thread.html">Thread</a>.</p>
         <h3><a name="wait">wait</a></h3><p class="brief">Wait for one or more synchronization strucures to become available. </p>
         <pre class="prototype">Threading.wait( ..., [waitTime] )</pre>
         <table class="prototype">
         <tbody><tr class="param"><td class="name">...</td><td class="content"> One or more synchronization structure to wait for. </td></tr>
               <tr class="optparam"><td class="name">waitTime</td><td class="content"> Maximum timeout in seconds and fractions. </td></tr>
               <tr class="return"><td class="name">Return</td><td class="content">nil if timeout expires, or the acquired item on success. </td></tr>
               <tr class="raise"><td class="name">Raise</td><td class="content"><table>
                     <tbody><tr><td class="name"><b>InterrutpedError</b></td><td class="content"> in case the thread receives a stop request. </td></tr>
                           </tbody>
                        </table>
                     </td></tr>
               </tbody>
            </table>
         <p>This method waits for one of the structures in the given parameters to become acquireable, and acquires it before returning. </p>
<p class="see_also">See also: <a href="feathers_threading_Thread.html">Thread</a>.</p>
         </div><ul class="navi_bottom"><li class="top"><a href="index.html">Top: Table of contents</a></li>
         <li class="up"><a href="feathers_threading.html">Up: Multithreading</a></li>
         <li class="prev"><a href="feathers_threading_ThreadError.html">Previous: Class ThreadError</a></li>
         <li class="next"><a href="feathers_threading_Waitable.html">Next: Class Waitable</a></li>
         <li class="clear"></li>
         </ul><div class="signature">Made with <a href="faldoc 3.0">http://www.falconpl.org</a></div></body></html>