diff options
Diffstat (limited to 'docs/index.html')
-rw-r--r-- | docs/index.html | 68 |
1 files changed, 64 insertions, 4 deletions
diff --git a/docs/index.html b/docs/index.html index 8b21a97..89710ab 100644 --- a/docs/index.html +++ b/docs/index.html | |||
@@ -37,7 +37,8 @@ | |||
37 | <p class="bar"> | 37 | <p class="bar"> |
38 | <a href="#description">Description</a> · | 38 | <a href="#description">Description</a> · |
39 | <a href="#systems">Supported systems</a> · | 39 | <a href="#systems">Supported systems</a> · |
40 | <a href="#installing">Building and Installing</a> | 40 | <a href="#installing">Building and Installing</a> · |
41 | <a href="#embedding">Embedding</a> | ||
41 | </p> | 42 | </p> |
42 | 43 | ||
43 | <p class="bar"> | 44 | <p class="bar"> |
@@ -69,7 +70,7 @@ | |||
69 | </p> | 70 | </p> |
70 | 71 | ||
71 | <p> | 72 | <p> |
72 | This document was revised on 30-Jan-13, and applies to version <tt>3.5.0</tt>. | 73 | This document was revised on 12-Feb-13, and applies to version <tt>3.5.1</tt>. |
73 | </p> | 74 | </p> |
74 | </font> | 75 | </font> |
75 | </center> | 76 | </center> |
@@ -164,6 +165,65 @@ | |||
164 | </pre> | 165 | </pre> |
165 | 166 | ||
166 | 167 | ||
168 | <!-- embedding +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
169 | <hr/> | ||
170 | <h2 id="embedding">Embedding</h2> | ||
171 | <p> | ||
172 | When Lanes is embedded, it is possible to statically initialize with | ||
173 | </p> | ||
174 | <table border=1 bgcolor="#E0E0FF" cellpadding="10" style="width:50%"> | ||
175 | <tr> | ||
176 | <td> | ||
177 | <pre> extern void LANES_API luaopen_lanes_embedded( lua_State* L, lua_CFunction _luaopen_lanes);</pre> | ||
178 | </td> | ||
179 | </tr> | ||
180 | </table> | ||
181 | <p> | ||
182 | <tt>luaopen_lanes_embedded</tt> leaves the module table on the stack. <tt>lanes.configure()</tt> must still be called in order to use Lanes. | ||
183 | <br/> | ||
184 | If <tt>_luaopen_lanes</tt> is <tt>NULL</tt>, a default loader will simply attempt the equivalent of <tt>luaL_dofile( L, "lanes.lua")</tt>. | ||
185 | </p> | ||
186 | |||
187 | <p> | ||
188 | To embed Lanes, compile source files in you application. In any Lua state were you want to use Lanes, initialize it as follows: | ||
189 | </p> | ||
190 | |||
191 | <p> | ||
192 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"> | ||
193 | <tr> | ||
194 | <td> | ||
195 | <pre> #include "lanes.h"</pre> | ||
196 | <br/> | ||
197 | <pre> int load_lanes_lua( lua_State* L)</pre> | ||
198 | <pre> {</pre> | ||
199 | <pre> // retrieve lanes.lua from wherever it is stored and return the result of its execution</pre> | ||
200 | <pre> // trivial example 1:</pre> | ||
201 | <pre> luaL_dofile( L, "lanes.lua");</pre> | ||
202 | <br/> | ||
203 | <pre> // trivial example 2:</pre> | ||
204 | <pre> luaL_dostring( L, bin2c_lanes_lua);</pre> | ||
205 | <pre> }</pre> | ||
206 | <br/> | ||
207 | <pre> void embed_lanes( lua_State* L)</pre> | ||
208 | <pre> {</pre> | ||
209 | <pre> // we need base libraries for Lanes for work</pre> | ||
210 | <pre> luaL_openlibs( L);</pre> | ||
211 | <pre> ...</pre> | ||
212 | <pre> // will attempt luaL_dofile( L, "lanes.lua");</pre> | ||
213 | <pre> luaopen_lanes_embedded( L, NULL);</pre> | ||
214 | <pre> lua_pop( L, 1);</pre> | ||
215 | <pre> // another example with a custom loader</pre> | ||
216 | <pre> luaopen_lanes_embedded( L, load_lanes_lua);</pre> | ||
217 | <pre> lua_pop( L, 1);</pre> | ||
218 | <br/> | ||
219 | <pre> // a little test to make sure things work as expected</pre> | ||
220 | <pre> luaL_dostring( L, "local lanes = require 'lanes'.configure{with_timers = false}; local l = lanes.linda()");</pre> | ||
221 | <pre> }</pre> | ||
222 | </td> | ||
223 | </tr> | ||
224 | </table> | ||
225 | </p> | ||
226 | |||
167 | <!-- launching +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 227 | <!-- launching +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
168 | <hr/> | 228 | <hr/> |
169 | 229 | ||
@@ -438,7 +498,7 @@ | |||
438 | </td> | 498 | </td> |
439 | <td/> | 499 | <td/> |
440 | <td> | 500 | <td> |
441 | All standard libraries (including those specific to LuaJIT and not listed above). This must be used alone. | 501 | All standard libraries (including those specific to LuaJIT and not listed above), as well as <tt>lanes.core</tt>. This must be used alone. |
442 | </td> | 502 | </td> |
443 | </tr> | 503 | </tr> |
444 | </table> | 504 | </table> |
@@ -765,7 +825,7 @@ | |||
765 | </p> | 825 | </p> |
766 | 826 | ||
767 | <p> | 827 | <p> |
768 | If the lane is still running after the timeout expired and <tt>force_kill</tt> is <tt>true</tt>, the OS thread running the lane is forcefully killed. This means no GC, and should generally be the last resort. | 828 | If the lane is still running after the timeout expired and <tt>force_kill</tt> is <tt>true</tt>, the OS thread running the lane is forcefully killed. This means no GC, probable OS resource leaks (thread stack, locks, DLL notifications), and should generally be the last resort. |
769 | </p> | 829 | </p> |
770 | 830 | ||
771 | <p> | 831 | <p> |