aboutsummaryrefslogtreecommitdiff
path: root/docs/index.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--docs/index.html57
1 files changed, 35 insertions, 22 deletions
diff --git a/docs/index.html b/docs/index.html
index f5a074f..20dccfa 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -336,8 +336,8 @@
336 <tt>nil</tt>/<tt>"protected"</tt>/function 336 <tt>nil</tt>/<tt>"protected"</tt>/function
337 </td> 337 </td>
338 <td> 338 <td>
339 If <tt>nil</tt>, Lua states are created with <tt>lua_newstate()</tt> and reuse the allocator from the master state.<br /> 339 If <tt>nil</tt>, Lua states are created with <tt>lua_newstate()</tt> and reuse the allocator from the master state.<br/>
340 If <tt>"protected"</tt>, The default allocator obtained from <tt>lua_getallocf()</tt> in the master state is wrapped inside a critical section and used in all newly created states.<br /> 340 If <tt>"protected"</tt>, The default allocator obtained from <tt>lua_getallocf()</tt> in the master state is wrapped inside a critical section and used in all newly created states.<br/>
341 If a <tt>function</tt>, this function is called prior to creating the state. It should return a full userdata containing the following structure: 341 If a <tt>function</tt>, this function is called prior to creating the state. It should return a full userdata containing the following structure:
342 <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"> 342 <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%">
343 <tr> 343 <tr>
@@ -360,8 +360,8 @@
360 </td> 360 </td>
361 <td> 361 <td>
362 Controls which allocator is used for Lanes internal allocations (for keeper, linda and lane management). 362 Controls which allocator is used for Lanes internal allocations (for keeper, linda and lane management).
363 If <tt>"libc"</tt>, Lanes uses <tt>realloc</tt> and <tt>free</tt>.<br /> 363 If <tt>"libc"</tt>, Lanes uses <tt>realloc</tt> and <tt>free</tt>.<br/>
364 If <tt>"allocator"</tt>, Lanes uses whatever was obtained from the <tt>"allocator"</tt> setting.<br /> 364 If <tt>"allocator"</tt>, Lanes uses whatever was obtained from the <tt>"allocator"</tt> setting.<br/>
365 This option is mostly useful for embedders that want control all memory allocations, but have issues when Lanes tries to use the Lua State allocator for internal purposes (especially with LuaJIT). 365 This option is mostly useful for embedders that want control all memory allocations, but have issues when Lanes tries to use the Lua State allocator for internal purposes (especially with LuaJIT).
366 </td> 366 </td>
367 </tr> 367 </tr>
@@ -455,6 +455,27 @@
455 </tr> 455 </tr>
456</table> 456</table>
457 457
458<p>
459 It is also possible to install a function that will be called when Lanes is shutdown (that is, when the first state that required Lanes is closed).
460</p>
461
462<p>
463 <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%">
464 <tr>
465 <td>
466 <pre> lanes.finally(&lt;some function&gt;|nil)</pre>
467 </td>
468 </tr>
469 </table>
470</p>
471
472<p>
473 An error will be raised if you attempt to do this from inside a lane, or on bad arguments (non-function, or too many arguments).<br/>
474 Only the last registered finalizer is kept. It can be cleared by passing <tt>nil</tt> or nothing.<br/>
475 The installed function is called after all free-running lanes are terminated, but before lindas become unusable.<br/>
476 If an error occurs inside this finalizer, it is silently swallowed, since it happens only during state shutdown, and you can't do anything about it.
477</p>
478
458<hr/> 479<hr/>
459<h2 id="creation">Creation</h2> 480<h2 id="creation">Creation</h2>
460 481
@@ -682,8 +703,7 @@
682 </td> 703 </td>
683 <td>table</td> 704 <td>table</td>
684 <td> 705 <td>
685 Sets the globals table for the launched threads. This can be used for giving them constants. The key/value pairs of <tt>table</tt> are transfered in the lane globals after the libraries have been loaded and the modules required. 706 Sets the globals table for the launched threads. This can be used for giving them constants. The key/value pairs of <tt>table</tt> are transfered in the lane globals after the libraries have been loaded and the modules required.<br/>
686 <br />
687 The global values of different lanes are in no manner connected; modifying one will only affect the particular lane. 707 The global values of different lanes are in no manner connected; modifying one will only affect the particular lane.
688 </td> 708 </td>
689 </tr> 709 </tr>
@@ -696,8 +716,7 @@
696 Lists modules that have to be required in order to be able to transfer functions they exposed. Starting with Lanes 3.0-beta, non-Lua functions are no longer copied by recreating a C closure from a C pointer, but are <a href="#function_notes">searched in lookup tables</a>. 716 Lists modules that have to be required in order to be able to transfer functions they exposed. Starting with Lanes 3.0-beta, non-Lua functions are no longer copied by recreating a C closure from a C pointer, but are <a href="#function_notes">searched in lookup tables</a>.
697 These tables are built from the modules listed here. <tt>required</tt> must be a list of strings, each one being the name of a module to be required. Each module is required with <tt>require()</tt> before the lanes function is invoked. 717 These tables are built from the modules listed here. <tt>required</tt> must be a list of strings, each one being the name of a module to be required. Each module is required with <tt>require()</tt> before the lanes function is invoked.
698 So, from the required module's point of view, requiring it manually from inside the lane body or having it required this way doesn't change anything. From the lane body's point of view, the only difference is that a module not creating a global won't be accessible. 718 So, from the required module's point of view, requiring it manually from inside the lane body or having it required this way doesn't change anything. From the lane body's point of view, the only difference is that a module not creating a global won't be accessible.
699 Therefore, a lane body will also have to require a module manually, but this won't do anything more (see Lua's <tt>require</tt> documentation). 719 Therefore, a lane body will also have to require a module manually, but this won't do anything more (see Lua's <tt>require</tt> documentation). <br/>
700 <br />
701 ATTEMPTING TO TRANSFER A FUNCTION REGISTERED BY A MODULE NOT LISTED HERE WILL RAISE AN ERROR. 720 ATTEMPTING TO TRANSFER A FUNCTION REGISTERED BY A MODULE NOT LISTED HERE WILL RAISE AN ERROR.
702 </td> 721 </td>
703 </tr> 722 </tr>
@@ -707,8 +726,8 @@
707 </td> 726 </td>
708 <td>string</td> 727 <td>string</td>
709 <td> 728 <td>
710 Sets the error reporting mode. One of <tt>"minimal"</tt> (the default), <tt>"basic"</tt>, <tt>"extended"</tt>.<br /> 729 Sets the error reporting mode. One of <tt>"minimal"</tt> (the default), <tt>"basic"</tt>, <tt>"extended"</tt>.<br/>
711 <tt>"minimal"</tt> yields only the location of the error.<br /> 730 <tt>"minimal"</tt> yields only the location of the error.<br/>
712 The other 2 yield a full stack trace, with different amounts of data extracted from the debug infos. See <a href="#results">Results</a>. 731 The other 2 yield a full stack trace, with different amounts of data extracted from the debug infos. See <a href="#results">Results</a>.
713 </td> 732 </td>
714 </tr> 733 </tr>
@@ -737,10 +756,8 @@
737 <td>integer</td> 756 <td>integer</td>
738 <td> 757 <td>
739 The priority of lanes generated in the range -3..+3 (default is 0). 758 The priority of lanes generated in the range -3..+3 (default is 0).
740 These values are a mapping over the actual priority range of the underlying implementation. 759 These values are a mapping over the actual priority range of the underlying implementation.<br/>
741 <br /> 760 Implementation and dependability of priorities varies by platform. Especially Linux kernel 2.6 is not supporting priorities in user mode.<br/>
742 Implementation and dependability of priorities varies by platform. Especially Linux kernel 2.6 is not supporting priorities in user mode.
743 <br />
744 A lane can also change its own thread priority dynamically with <a href="#priority"><tt>lanes.set_thread_priority()</tt></a>. 761 A lane can also change its own thread priority dynamically with <a href="#priority"><tt>lanes.set_thread_priority()</tt></a>.
745 </td> 762 </td>
746 </tr> 763 </tr>
@@ -750,8 +767,7 @@
750 </td> 767 </td>
751 <td> table</td> 768 <td> table</td>
752 <td> 769 <td>
753 Specifying it when <code>libs_str</code> doesn't cause the <code>package</code> library to be loaded will generate an error. 770 Specifying it when <code>libs_str</code> doesn't cause the <code>package</code> library to be loaded will generate an error.<br/>
754 <br />
755 If not specified, the created lane will receive the current values of <tt>package</tt>. Only <tt>path</tt>, <tt>cpath</tt>, <tt>preload</tt> and <tt>loaders</tt> (Lua 5.1)/<tt>searchers</tt> (Lua 5.2) are transfered. 771 If not specified, the created lane will receive the current values of <tt>package</tt>. Only <tt>path</tt>, <tt>cpath</tt>, <tt>preload</tt> and <tt>loaders</tt> (Lua 5.1)/<tt>searchers</tt> (Lua 5.2) are transfered.
756 </td> 772 </td>
757 </tr> 773 </tr>
@@ -1754,12 +1770,9 @@ static MyDeepFactory g_MyDeepFactory;
1754</p> 1770</p>
1755 1771
1756<p> 1772<p>
1757 Deep userdata in transit inside keeper states (sent in a linda but not yet consumed) don't call <tt>deleteDeepObjectInternal</tt> and aren't considered by reference counting. The rationale is the following: 1773 Deep userdata in transit inside keeper states (sent in a linda but not yet consumed) don't call <tt>deleteDeepObjectInternal</tt> and aren't considered by reference counting. The rationale is the following:<br/>
1758 <br /> 1774 If some non-keeper state holds a deep userdata for some deep object, then even if the keeper collects its own deep userdata, it shouldn't be cleaned up since the refcount is not 0.<br/>
1759 If some non-keeper state holds a deep userdata for some deep object, then even if the keeper collects its own deep userdata, it shouldn't be cleaned up since the refcount is not 0. 1775 OTOH, if a keeper state holds the last deep userdata for some deep object, then no lane can do actual work with it. Deep userdata's <tt>factory()</tt> interface is never accessed from a keeper state.<br/>
1760 <br />
1761 OTOH, if a keeper state holds the last deep userdata for some deep object, then no lane can do actual work with it. Deep userdata's <tt>factory()</tt> interface is never accessed from a keeper state.
1762 <br />
1763 Therefore, Lanes can just call <tt>deleteDeepObjectInternal</tt> when the last non-keeper-held deep userdata is collected, as long as it doesn't do the same in a keeper state after that, since any remaining deep userdata in keeper states now hold stale pointers. 1776 Therefore, Lanes can just call <tt>deleteDeepObjectInternal</tt> when the last non-keeper-held deep userdata is collected, as long as it doesn't do the same in a keeper state after that, since any remaining deep userdata in keeper states now hold stale pointers.
1764</p> 1777</p>
1765 1778