From 076344633e7b2525cf48005f84f3935f324b60bf Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Sat, 18 Feb 2012 14:08:52 +0100 Subject: * changed lanes.configure signature to receive a table instead of individual parameters * added support for an on_state_create callback called to load custom functions in a state in addition to the base libraries --- docs/index.html | 104 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 64 insertions(+), 40 deletions(-) (limited to 'docs') diff --git a/docs/index.html b/docs/index.html index e24b172..72e91ba 100644 --- a/docs/index.html +++ b/docs/index.html @@ -56,7 +56,7 @@


Copyright © 2007-12 Asko Kauppi, Benoit Germain. All rights reserved.
Lua Lanes is published under the same MIT license as Lua 5.1. -

This document was revised on 5-Nov-11, and applies to version 3.0-beta. +

This document was revised on 17-Feb-11, and applies to version 3.1.0

@@ -173,8 +173,7 @@ Or use Lua Rocks package m
-          local lanes = require "lanes"
-          lanes.configure( 1)
+          local lanes = require "lanes".configure()
         
@@ -182,11 +181,11 @@ Or use Lua Rocks package m Starting with version 3.0-beta, requiring the module follows Lua 5.2 rules: the module is not available under the global name "lanes", but has to be accessed through require's return value. - After lanes is required, it is necessary to call lanes.configure(), which is the - only function exposed by the module at this point. Calling configure() will + After lanes is required, it is necessary to call lanes.configure(), which is the + only function exposed by the module at this point. Calling configure() will perform one-time initializations and make the rest of the API available. - At the same time, configure() itself will be replaced by another function that - raises an error if called with differing arguments. + At the same time, configure() itself will be replaced by another function that + raises an error if called again with differing arguments.

@@ -194,19 +193,39 @@ Or use Lua Rocks package m - lanes.configure( [nb_keepers] [, "NO_TIMERS"]) + lanes.configure( [opt_tbl])

- lanes.configure accepts 2 arguments. The first one controls the number - of keeper states used internally by lindas to transfer data between lanes. (see below). - Default is 1. -

-

If the second argument is equal to "NO_TIMERS", Lanes doesn't start the timer service, + lanes.configure accepts an optional options table as sole argument. + + + + + + + + + +
+ .nb_keepers
N
+ Controls the number of keeper states used internally by lindas to transfer data between lanes. (see below). Default is 1. +
+ .with_timers
nil/false/anything
+ + If equal to false, Lanes doesn't start the timer service, and the associated API will be absent from the interface (see below). -

-

Creation

+ Any other value (including nil), starts the timer service. +
+ + .on_create_state
C function/nil +
+ + 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. +
+

Creation

The following sample shows preparing a function for parallel calling, and calling it with varying arguments. Each of the two results is calculated in @@ -217,7 +236,7 @@ joins the threads, waiting for any results not already there.
   local lanes = require "lanes"
-  lanes.configure( 1)
+  lanes.configure()
 
   f= lanes.gen( function(n) return 2*n end )
   a= f(1)
@@ -240,8 +259,8 @@ joins the threads, waiting for any results not already there.
     but the particular arguments may vary. Only calling the generator function
     actually launches a lane, and provides a handle for controlling it.
     Alternatively, lane_func may be a string, in which case it will be compiled
-    in the lane. This is to be able to launch lanes whith LuaJIT,
-    which does not support lua_dump, used internally to transfer functions to the lane.
+    in the lane. This was to be able to launch lanes with older versions of LuaJIT,
+    which didn't not support lua_dump, used internally to transfer functions to the lane.