diff options
Diffstat (limited to '')
-rw-r--r-- | docs/index.html | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/docs/index.html b/docs/index.html index 4dd5848..116fc0a 100644 --- a/docs/index.html +++ b/docs/index.html | |||
@@ -64,13 +64,13 @@ | |||
64 | <font size="-1"> | 64 | <font size="-1"> |
65 | <p> | 65 | <p> |
66 | <br /> | 66 | <br /> |
67 | <i>Copyright © 2007-24 Asko Kauppi, Benoit Germain. All rights reserved.</i> | 67 | <i>Copyright © 2007-25 Asko Kauppi, Benoit Germain. All rights reserved.</i> |
68 | <br /> | 68 | <br /> |
69 | Lua Lanes is published under the same <a href="http://en.wikipedia.org/wiki/MIT_License">MIT license</a> as Lua 5.1, 5.2, 5.3 and 5.4. | 69 | Lua Lanes is published under the same <a href="http://en.wikipedia.org/wiki/MIT_License">MIT license</a> as Lua 5.1, 5.2, 5.3 and 5.4. |
70 | </p> | 70 | </p> |
71 | 71 | ||
72 | <p> | 72 | <p> |
73 | This document was revised on 17-Mar-25, and applies to version <tt>4.0.0</tt>. | 73 | This document was revised on 18-Apr-25, and applies to version <tt>4.0.0</tt>. |
74 | </p> | 74 | </p> |
75 | </font> | 75 | </font> |
76 | </center> | 76 | </center> |
@@ -271,7 +271,7 @@ | |||
271 | </p> | 271 | </p> |
272 | 272 | ||
273 | <p> | 273 | <p> |
274 | <tt>lanes.configure</tt> accepts an optional options table as sole argument. | 274 | <tt>lanes.configure</tt> accepts an optional table as sole argument. |
275 | <table border="1" cellpadding="10" style="width:100%"> | 275 | <table border="1" cellpadding="10" style="width:100%"> |
276 | <tr> | 276 | <tr> |
277 | <th style="width:15%">name</th> | 277 | <th style="width:15%">name</th> |
@@ -337,6 +337,22 @@ | |||
337 | </tr> | 337 | </tr> |
338 | 338 | ||
339 | <tr valign=top> | 339 | <tr valign=top> |
340 | <td id="linda_wake_period"> | ||
341 | <code>.linda_wake_period</code> | ||
342 | </td> | ||
343 | <td> | ||
344 | number > 0 | ||
345 | </td> | ||
346 | <td> | ||
347 | Sets the default period in seconds a linda will wake by itself during blocked operations. Default is never.<br /> | ||
348 | When a Linda enters a blocking call (<tt>send()</tt>, <tt>receive()</tt>, <tt>receive_batched()</tt>, <tt>sleep()</tt>), it normally sleeps either until the operation completes | ||
349 | or the specified timeout expires. With this setting, the default behavior can be changed to wake periodically. This can help for example with timing issues where a lane is signalled | ||
350 | for cancellation, but a linda inside the lane was in the middle of processing an operation but did not actually start the wait. This can result in the signal to be ignored, thus | ||
351 | causing the Linda to wait out the full operation timeout before cancellation is processed. | ||
352 | </td> | ||
353 | </tr> | ||
354 | |||
355 | <tr valign=top> | ||
340 | <td id="nb_user_keepers"> | 356 | <td id="nb_user_keepers"> |
341 | <code>.nb_user_keepers</code> | 357 | <code>.nb_user_keepers</code> |
342 | </td> | 358 | </td> |
@@ -1222,7 +1238,7 @@ | |||
1222 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> | 1238 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> |
1223 | local lanes = require "lanes" | 1239 | local lanes = require "lanes" |
1224 | 1240 | ||
1225 | local linda = lanes.linda("my linda") | 1241 | local linda = lanes.linda{name = "my linda"} |
1226 | 1242 | ||
1227 | local function loop(max) | 1243 | local function loop(max) |
1228 | for i = 1, max do | 1244 | for i = 1, max do |
@@ -1276,16 +1292,24 @@ | |||
1276 | </p> | 1292 | </p> |
1277 | 1293 | ||
1278 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> | 1294 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> |
1279 | h = lanes.linda([name],[group],[close_handler]) | 1295 | h = lanes.linda(table|nil) |
1280 | </pre></td></tr></table> | 1296 | </pre></td></tr></table> |
1281 | 1297 | ||
1282 | <p> | 1298 | <p> |
1283 | Arguments to <tt>lanes.linda()</tt> can be provided in any order, as long as there is a single string, a single number, and a single callable value (all are optional).<br /> | 1299 | Argument to <tt>lanes.linda()</tt> is either <tt>nil</tt> or a single table. The table may contain the following entries: |
1284 | Converting the linda to a string will yield the provided name prefixed by <tt>"Linda: "</tt>.<br /> | 1300 | <ul> |
1285 | If <tt>opt_name</tt> is omitted, it will evaluate to an hexadecimal number uniquely representing that linda when the linda is converted to a string. The value is the same as returned by <tt>linda:deep()</tt>.<br /> | 1301 | <li><tt>close_handler</tt>: a callable object (function or table/userdata with <tt>__call</tt> metamethod). If provided, and the linda is to-be-closed (Lua 5.4+), it will be called with all the provided arguments. For older Lua versions, its presence is ignored.</li> |
1286 | If <tt>opt_name</tt> is <tt>"auto"</tt>, Lanes will try to construct a name from the source location that called <tt>lanes.linda()</tt>. If that fails, the linda name will be <tt>"<unresolved>"</tt>.<br /> | 1302 | <li><tt>group</tt>: an integer between 0 and the number of Keeper states. Mandatory if Lanes is configured with more than one Keeper state. Group 0 is used by the internal timer linda.</li> |
1287 | If Lanes is configured with more than one Keeper state, <tt>group</tt> is mandatory.<br /> | 1303 | <li> |
1288 | If the linda is to-be-closed (Lua 5.4+), and a <tt>close_handler</tt> is provided, it will be called with all the provided arguments. For older Lua versions, its presence will cause an error. | 1304 | <tt>name</tt>: a string. Converting the linda to a string will yield the provided name prefixed by <tt>"Linda: "</tt>. |
1305 | If omitted or empty, it will evaluate to the string representation of a hexadecimal number uniquely representing that linda when the linda is converted to a string. The numeric value is the same as returned by <tt>linda:deep()</tt>.<br /> | ||
1306 | If <tt>"auto"</tt>, Lanes will try to construct a name from the source location that called <tt>lanes.linda()</tt>. If that fails, the linda name will be <tt>"<unresolved>"</tt>. | ||
1307 | </li> | ||
1308 | <li> | ||
1309 | <tt>wake_period</tt>: a number > 0 (unit: seconds). If provided, overrides <a href="#linda_wake_period"><tt>linda_wake_period</tt></a> provided to <a href="#initialization"><tt>lanes.configure()</tt></a>. | ||
1310 | </li> | ||
1311 | </ul> | ||
1312 | Unknown fields are silently ignored. | ||
1289 | </p> | 1313 | </p> |
1290 | 1314 | ||
1291 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> | 1315 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> |