diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2013-01-30 20:28:47 +0100 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2013-01-30 20:28:47 +0100 |
commit | b657f38535c3c27a848353ef853d6667d6acc917 (patch) | |
tree | 8679a62c0b6343eae4781cff10a0ea60460d9cb4 /docs | |
parent | 3377b95704e611a288791fee6a7bc59c5ecebf2d (diff) | |
download | lanes-b657f38535c3c27a848353ef853d6667d6acc917.tar.gz lanes-b657f38535c3c27a848353ef853d6667d6acc917.tar.bz2 lanes-b657f38535c3c27a848353ef853d6667d6acc917.zip |
version 3.5.0
* new: API lanes.require(), use it instead of regular require() for modules that export C functions you need to send over.
* new: lanes no longer require 'lanes.core' by default in every created state. Use {required={"lanes.core"}} if you need to transfer lanes functions.
* internal: because of the above, reworked the timer implementation to remove upvalue-dependency on lanes.core
* new: API lanes.timer_lane, to be able to operate on timer lane if need be
* improved: if a module is a full userdata, scan its metatable for function database population
* improved: on_state_create can be a Lua function
* changed: on_state_create is called after the base libraries are loaded
* package[loaders|searchers] is no longer transfered as function naming depends on slot order
* internal: changed separator from '.' to '/' in lookup databases to be able to distinguish search levels and dot coming from module names
* added some mode debug spew
* updated tests to reflect the above changes
Diffstat (limited to 'docs')
-rw-r--r-- | docs/index.html | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/docs/index.html b/docs/index.html index 4f31923..8b21a97 100644 --- a/docs/index.html +++ b/docs/index.html | |||
@@ -69,7 +69,7 @@ | |||
69 | </p> | 69 | </p> |
70 | 70 | ||
71 | <p> | 71 | <p> |
72 | This document was revised on 26-Jan-13, and applies to version <tt>3.4.4</tt>. | 72 | This document was revised on 30-Jan-13, and applies to version <tt>3.5.0</tt>. |
73 | </p> | 73 | </p> |
74 | </font> | 74 | </font> |
75 | </center> | 75 | </center> |
@@ -249,10 +249,17 @@ | |||
249 | <code>.on_state_create</code> | 249 | <code>.on_state_create</code> |
250 | </td> | 250 | </td> |
251 | <td> | 251 | <td> |
252 | C function/<tt>nil</tt> | 252 | function/<tt>nil</tt> |
253 | </td> | 253 | </td> |
254 | <td> | 254 | <td> |
255 | If provided, will be called in every created Lua state (keepers and lanes) right after it is created, and *before* any library is loaded. That way, all C functions it loads in the state can be added to the function lookup database. Default is <tt>nil</tt>. | 255 | If provided, will be called in every created Lua state (keepers and lanes) right after initializing the base libraries. |
256 | <br> | ||
257 | Typical usage is twofold: | ||
258 | <ul> | ||
259 | <li>Tweak <tt>package.loaders</tt></li> | ||
260 | <li>Load some additional C functions in the global space (of course only a C function will be able to do this).</li> | ||
261 | </ul> | ||
262 | That way, all changes in the state can be properly taken into account when building the function lookup database. Default is <tt>nil</tt>. | ||
256 | </td> | 263 | </td> |
257 | </tr> | 264 | </tr> |
258 | 265 | ||
@@ -270,6 +277,22 @@ | |||
270 | </table> | 277 | </table> |
271 | </p> | 278 | </p> |
272 | 279 | ||
280 | <p> | ||
281 | NEW (version 3.5.0) | ||
282 | <br> | ||
283 | Once Lanes is configured, one should register with Lanes the modules exporting functions that will be transferred either during lane generation or through <a href="#lindas">lindas</a>. | ||
284 | <br> | ||
285 | Use <tt>lanes.require()</tt> for this purpose. This will call the original <tt>require()</tt>, then add the result to the lookup databases. | ||
286 | </p> | ||
287 | |||
288 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"> | ||
289 | <tr> | ||
290 | <td> | ||
291 | <pre> local m = lanes.require "modname"</pre> | ||
292 | </td> | ||
293 | </tr> | ||
294 | </table> | ||
295 | |||
273 | <hr/> | 296 | <hr/> |
274 | <h2 id="creation">Creation</h2> | 297 | <h2 id="creation">Creation</h2> |
275 | 298 | ||
@@ -468,6 +491,8 @@ | |||
468 | 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. | 491 | 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. |
469 | 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. | 492 | 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. |
470 | 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). | 493 | 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). |
494 | <br> | ||
495 | ATTEMPTING TO TRANSFER A FUNCTION REGISTERED BY A MODULE NOT LISTED HERE WILL RAISE AN ERROR. | ||
471 | </td> | 496 | </td> |
472 | </tr> | 497 | </tr> |
473 | <tr valign=top> | 498 | <tr valign=top> |
@@ -567,7 +592,7 @@ | |||
567 | </td> | 592 | </td> |
568 | <td/> | 593 | <td/> |
569 | <td> | 594 | <td> |
570 | running, not suspended on a Linda call. | 595 | running, not suspended on a <a href="#lindas">Linda</a> call. |
571 | </td> | 596 | </td> |
572 | </tr> | 597 | </tr> |
573 | <tr> | 598 | <tr> |
@@ -577,7 +602,7 @@ | |||
577 | </td> | 602 | </td> |
578 | <td/> | 603 | <td/> |
579 | <td> | 604 | <td> |
580 | waiting at a Linda <tt>:receive()</tt> or <tt>:send()</tt> | 605 | waiting at a <a href="#lindas">Linda</a> <tt>:receive()</tt> or <tt>:send()</tt> |
581 | </td> | 606 | </td> |
582 | </tr> | 607 | </tr> |
583 | <tr> | 608 | <tr> |
@@ -711,7 +736,7 @@ | |||
711 | </pre></td></tr></table> | 736 | </pre></td></tr></table> |
712 | 737 | ||
713 | <p> | 738 | <p> |
714 | If you want to wait for multiple lanes to finish (any of a set of lanes), use a <a href="#lindas">Linda</a> object. Give each lane a specific id, and send that id over a Linda once that thread is done (as the last thing you do). | 739 | If you want to wait for multiple lanes to finish (any of a set of lanes), use a <a href="#lindas">Linda</a> object. Give each lane a specific id, and send that id over a <a href="#lindas">Linda</a> once that thread is done (as the last thing you do). |
715 | </p> | 740 | </p> |
716 | 741 | ||
717 | <table border=1 bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> | 742 | <table border=1 bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> |
@@ -750,7 +775,7 @@ | |||
750 | <p> | 775 | <p> |
751 | Cancellation is tested <u>before</u> going to sleep in <tt>receive()</tt> or <tt>send()</tt> calls and after executing <tt>cancelstep</tt> Lua statements. Starting with version 3.0-beta, a pending <tt>receive()</tt>or <tt>send()</tt> call is awakened. | 776 | Cancellation is tested <u>before</u> going to sleep in <tt>receive()</tt> or <tt>send()</tt> calls and after executing <tt>cancelstep</tt> Lua statements. Starting with version 3.0-beta, a pending <tt>receive()</tt>or <tt>send()</tt> call is awakened. |
752 | <br> | 777 | <br> |
753 | This means the execution of the lane will resume although the operation has not completed, to give the lane a chance to detect cancellation (even in the case the code waits on a linda with infinite timeout). | 778 | This means the execution of the lane will resume although the operation has not completed, to give the lane a chance to detect cancellation (even in the case the code waits on a <a href="#lindas">linda</a> with infinite timeout). |
754 | <br> | 779 | <br> |
755 | The code should be able to handle this situation appropriately if required (in other words, it should gracefully handle the fact that it didn't receive the expected values). | 780 | The code should be able to handle this situation appropriately if required (in other words, it should gracefully handle the fact that it didn't receive the expected values). |
756 | <br> | 781 | <br> |