diff options
Diffstat (limited to '')
-rw-r--r-- | docs/index.html | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/docs/index.html b/docs/index.html index 92cc38a..f5a074f 100644 --- a/docs/index.html +++ b/docs/index.html | |||
@@ -183,7 +183,7 @@ | |||
183 | </tr> | 183 | </tr> |
184 | </table> | 184 | </table> |
185 | <p> | 185 | <p> |
186 | <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. | 186 | <tt>luaopen_lanes_embedded</tt> leaves the module table on the stack. <a href="#initialization"><tt>lanes.configure()</tt></a> must still be called in order to use Lanes. |
187 | <br/> | 187 | <br/> |
188 | If <tt>_luaopen_lanes</tt> is <tt>nullptr</tt>, a default loader will simply attempt the equivalent of <tt>luaL_dofile(L, "lanes.lua")</tt>. | 188 | If <tt>_luaopen_lanes</tt> is <tt>nullptr</tt>, a default loader will simply attempt the equivalent of <tt>luaL_dofile(L, "lanes.lua")</tt>. |
189 | </p> | 189 | </p> |
@@ -249,17 +249,17 @@ | |||
249 | Requiring the module follows Lua 5.2+ rules: the module is not available under the global name "lanes", but has to be accessed through <tt>require</tt>'s return value. | 249 | Requiring the module follows Lua 5.2+ rules: the module is not available under the global name "lanes", but has to be accessed through <tt>require</tt>'s return value. |
250 | </p> | 250 | </p> |
251 | <p> | 251 | <p> |
252 | After lanes is required, it is necessary to call <tt>lanes.configure()</tt>, which is the only function exposed by the module at this point. Calling <tt>configure()</tt> will perform one-time initializations and make the rest of the API available. | 252 | After lanes is required, it is necessary to call <tt>lanes.configure()</tt>, which is the only function exposed by the module at this point. Calling <tt>lanes.configure()</tt> will perform one-time initializations and make the rest of the API available. |
253 | </p> | 253 | </p> |
254 | <p> | 254 | <p> |
255 | At the same time, <tt>configure()</tt> itself will be replaced by another function that raises an error if called again with differing arguments, if any. | 255 | At the same time, <tt>lanes.configure()</tt> itself will be replaced by another function that raises an error if called again with differing arguments, if any. |
256 | </p> | 256 | </p> |
257 | <p> | 257 | <p> |
258 | Also, once Lanes is initialized, <tt>require()</tt> is replaced by another one that wraps it inside a mutex, both in the main state and in all created lanes. This prevents multiple thread-unsafe module initializations from several lanes to occur simultaneously. | 258 | Also, once Lanes is initialized, <tt>require()</tt> is replaced by another one that wraps it inside a mutex, both in the main state and in all created lanes. This prevents multiple thread-unsafe module initializations from several lanes to occur simultaneously. |
259 | It remains to be seen whether this is actually useful or not: If a module is already threadsafe, protecting its initialization isn't useful. And if it is not, any parallel operation may crash without Lanes being able to do anything about it. | 259 | It remains to be seen whether this is actually useful or not: If a module is already threadsafe, protecting its initialization isn't useful. And if it is not, any parallel operation may crash without Lanes being able to do anything about it. |
260 | </p> | 260 | </p> |
261 | <p> | 261 | <p> |
262 | <b>IMPORTANT NOTE:</b> Only the first occurence of <tt>require "lanes"</tt> must be followed by a call to <tt>.configure()</tt>. From this point, a simple <tt>require "lanes"</tt> will do wherever you need to require lanes again. | 262 | <b>IMPORTANT NOTE:</b> Only the first occurence of <tt>require "lanes"</tt> must be followed by a call to <tt>lanes.configure()</tt>. From this point, a simple <tt>require "lanes"</tt> will be enough wherever you need to require lanes again. |
263 | </p> | 263 | </p> |
264 | 264 | ||
265 | <p> | 265 | <p> |
@@ -758,8 +758,10 @@ | |||
758 | </table> | 758 | </table> |
759 | 759 | ||
760 | <p> | 760 | <p> |
761 | Each lane also gets a global function <tt>set_debug_threadname()</tt> that it can use anytime to do as the name says. Supported debuggers are Microsoft Visual Studio (for the C side) and Decoda (for the Lua side). | 761 | Each lane gets a global function <tt>set_debug_threadname()</tt> that it can use anytime to do as the name says. Supported debuggers are Microsoft Visual Studio (for the C side) and <a href="https://github.com/unknownworlds/decoda">Decoda</a> (for the Lua side).<br/> |
762 | <br/> | 762 | Decoda support is limited to setting a special global variable <tt>decoda_name</tt>. This is disabled by default. Change <tt>HAVE_DECODA_NAME()</tt> in <tt>lanesconf.h</tt> if necessary.<br/> |
763 | The name is stored inside the Lua state registry so that it is available for error reporting. Changing <tt>decoda_name</tt> doesn't affect this hidden name or the OS thread name reported by MSVC.<br/> | ||
764 | When Lanes is initialized by the first <a href="#initialization"><tt>lanes.configure()</tt></a> call, <tt>"main"</tt> is stored in the registry in the same fashion (but <tt>decoda_name</tt> and the OS thread name are left unchanged).<br/> | ||
763 | The lane also has a method <tt>lane:get_debug_threadname()</tt> that gives access to that name from the caller side (returns <tt>"<unnamed>"</tt> if unset, <tt>"<closed>"</tt> if the internal Lua state is closed). | 765 | The lane also has a method <tt>lane:get_debug_threadname()</tt> that gives access to that name from the caller side (returns <tt>"<unnamed>"</tt> if unset, <tt>"<closed>"</tt> if the internal Lua state is closed). |
764 | </p> | 766 | </p> |
765 | 767 | ||
@@ -1334,7 +1336,7 @@ | |||
1334 | 1336 | ||
1335 | <li> | 1337 | <li> |
1336 | Performance. Changing any slot in a Linda causes all pending threads for that Linda to be momentarily awakened (at least in the C level). | 1338 | Performance. Changing any slot in a Linda causes all pending threads for that Linda to be momentarily awakened (at least in the C level). |
1337 | This can degrade performance due to unnecessary OS level context switches. The more keeper states you declared with <tt>lanes.configure()</tt> the less this should be a problem. | 1339 | This can degrade performance due to unnecessary OS level context switches. The more keeper states you declared with <a href="#initialization"><tt>lanes.configure()</tt></a> the less this should be a problem. |
1338 | </li> | 1340 | </li> |
1339 | </ul> | 1341 | </ul> |
1340 | 1342 | ||
@@ -1356,7 +1358,7 @@ events to a common Linda, but... :).</font> | |||
1356 | </pre></td></tr></table> | 1358 | </pre></td></tr></table> |
1357 | 1359 | ||
1358 | <p> | 1360 | <p> |
1359 | Timers are implemented as a lane. They can be enabled by setting "<tt><a href="#with_timers">with_timers</a></tt>" to <tt>true</tt> in <tt>lanes.configure()</tt> settings. | 1361 | Timers are implemented as a lane. They can be enabled by setting "<tt><a href="#with_timers">with_timers</a></tt>" to <tt>true</tt> in <a href="#initialization"><tt>lanes.configure()</tt></a> settings. |
1360 | </p> | 1362 | </p> |
1361 | 1363 | ||
1362 | <p> | 1364 | <p> |
@@ -1373,7 +1375,7 @@ events to a common Linda, but... :).</font> | |||
1373 | 1375 | ||
1374 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> | 1376 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> |
1375 | local lanes = require "lanes" | 1377 | local lanes = require "lanes" |
1376 | lanes.configure() | 1378 | lanes.configure{with_timers = true} |
1377 | 1379 | ||
1378 | local linda = lanes.linda() | 1380 | local linda = lanes.linda() |
1379 | 1381 | ||