diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2025-09-29 16:02:45 +0200 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2025-09-29 16:02:45 +0200 |
| commit | 4e109a0c12d245b155bf03cb561c01b242666395 (patch) | |
| tree | 390bb77ceffef9f7200ec49fe61aed560d8d4ca9 /docs | |
| parent | 4f5d5ea60e5b5bd42a3bdab5460c2c0fda365a4d (diff) | |
| download | lanes-4e109a0c12d245b155bf03cb561c01b242666395.tar.gz lanes-4e109a0c12d245b155bf03cb561c01b242666395.tar.bz2 lanes-4e109a0c12d245b155bf03cb561c01b242666395.zip | |
Many small doc tweaks
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/index.html | 81 |
1 files changed, 42 insertions, 39 deletions
diff --git a/docs/index.html b/docs/index.html index 9270ce6..eba39bb 100644 --- a/docs/index.html +++ b/docs/index.html | |||
| @@ -71,7 +71,7 @@ | |||
| 71 | </p> | 71 | </p> |
| 72 | 72 | ||
| 73 | <p> | 73 | <p> |
| 74 | This document was revised on 22-Sep-2025, and applies to version <tt>4.0.0</tt>. | 74 | This document was revised on 29-Sep-2025, and applies to version <tt>4.0.0</tt>. |
| 75 | </p> | 75 | </p> |
| 76 | </font> | 76 | </font> |
| 77 | </center> | 77 | </center> |
| @@ -186,10 +186,11 @@ | |||
| 186 | <li><tt>lanes.coro()</tt>: start a coroutine-like lane</li> | 186 | <li><tt>lanes.coro()</tt>: start a coroutine-like lane</li> |
| 187 | <li><tt>lanes.finally()</tt>: install a function called on Lanes shutdown</li> | 187 | <li><tt>lanes.finally()</tt>: install a function called on Lanes shutdown</li> |
| 188 | <li><tt>lanes.gen()</tt>: start a lane as a regular function</li> | 188 | <li><tt>lanes.gen()</tt>: start a lane as a regular function</li> |
| 189 | <li><tt>lanes.genactomic()</tt>: obtain an atomic counter</li> | 189 | <li><tt>lanes.genatomic()</tt>: obtain an atomic counter</li> |
| 190 | <li><tt>lanes.genlock()</tt>: obtain an atomic-like data stack</li> | 190 | <li><tt>lanes.genlock()</tt>: obtain an atomic-like data stack</li> |
| 191 | <li><tt>lanes.linda()</tt>: create a Linda</li> | 191 | <li><tt>lanes.linda()</tt>: create a <a href="#lindas">linda</a></li> |
| 192 | <li><tt>lanes.nameof()</tt>: find where a value exists</li> | 192 | <li><tt>lanes.nameof()</tt>: find where a value exists</li> |
| 193 | <li><tt>lanes.null</tt>: a light userdata used to represent <tt>nil</tt> in data transfers</li> | ||
| 193 | <li><tt>lanes.thread_priority_range()</tt>: obtain the valid range of thread priorities</li> | 194 | <li><tt>lanes.thread_priority_range()</tt>: obtain the valid range of thread priorities</li> |
| 194 | <li><tt>lanes.now_secs()</tt>: obtain the current clock value</li> | 195 | <li><tt>lanes.now_secs()</tt>: obtain the current clock value</li> |
| 195 | <li><tt>lanes.register()</tt>: scan modules so that functions using them can be transferred</li> | 196 | <li><tt>lanes.register()</tt>: scan modules so that functions using them can be transferred</li> |
| @@ -198,6 +199,7 @@ | |||
| 198 | <li><tt>lanes.threads()</tt>: obtain a list of all lanes</li> | 199 | <li><tt>lanes.threads()</tt>: obtain a list of all lanes</li> |
| 199 | <li><tt>lanes.sleep()</tt>: sleep for a given duration</li> | 200 | <li><tt>lanes.sleep()</tt>: sleep for a given duration</li> |
| 200 | <li><tt>lanes.timer()</tt>: start a timer</li> | 201 | <li><tt>lanes.timer()</tt>: start a timer</li> |
| 202 | <li><tt>lanes.timer_lane</tt>: the lane that manages timers</li> | ||
| 201 | <li><tt>lanes.timers()</tt>: list active timers</li> | 203 | <li><tt>lanes.timers()</tt>: list active timers</li> |
| 202 | </ul> | 204 | </ul> |
| 203 | </li> | 205 | </li> |
| @@ -222,11 +224,11 @@ | |||
| 222 | </ul> | 224 | </ul> |
| 223 | </li> | 225 | </li> |
| 224 | <li> | 226 | <li> |
| 225 | Given some Linda <tt>l</tt> | 227 | Given some <a href="#lindas">linda</a> <tt>l</tt> |
| 226 | <ul> | 228 | <ul> |
| 227 | <li><tt>l:cancel()</tt>: mark a Linda for cancellation</li> | 229 | <li><tt>l:cancel()</tt>: mark a <a href="#lindas">linda</a> for cancellation</li> |
| 228 | <li><tt>l:collectgarbage()</tt>: trigger a GC cycle in the Linda's Keeper state</li> | 230 | <li><tt>l:collectgarbage()</tt>: trigger a GC cycle in the <a href="#lindas">linda</a>'s Keeper state</li> |
| 229 | <li><tt>l:deep()</tt>: obtain a light userdata uniquely representing the Linda</li> | 231 | <li><tt>l:deep()</tt>: obtain a light userdata uniquely representing the <a href="#lindas">linda</a></li> |
| 230 | <li><tt>l:dump()</tt>: have information about slot contents</li> | 232 | <li><tt>l:dump()</tt>: have information about slot contents</li> |
| 231 | <li><tt>l:count()</tt>: obtain a count of data items in slots</li> | 233 | <li><tt>l:count()</tt>: obtain a count of data items in slots</li> |
| 232 | <li><tt>l:get()</tt>: read data without consuming it</li> | 234 | <li><tt>l:get()</tt>: read data without consuming it</li> |
| @@ -242,7 +244,7 @@ | |||
| 242 | <li> | 244 | <li> |
| 243 | embedding | 245 | embedding |
| 244 | <ul> | 246 | <ul> |
| 245 | <li><tt>luaopen_lanes_embedded</tt>: manually initialize Lanes</li> | 247 | <li><tt>luaopen_lanes_embedded()</tt>: manually initialize Lanes</li> |
| 246 | </ul> | 248 | </ul> |
| 247 | </li> | 249 | </li> |
| 248 | </ul> | 250 | </ul> |
| @@ -447,11 +449,11 @@ | |||
| 447 | number > 0 | 449 | number > 0 |
| 448 | </td> | 450 | </td> |
| 449 | <td> | 451 | <td> |
| 450 | Sets the default period in seconds a linda will wake by itself during blocked operations. Default is never.<br /> | 452 | Sets the default period in seconds a <a href="#lindas">linda</a> will wake by itself during blocked operations. Default is never.<br /> |
| 451 | 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 | 453 | When a <a href="#lindas">linda</a> 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 |
| 452 | 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 | 454 | 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 |
| 453 | 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 | 455 | for cancellation, but a <a href="#lindas">linda</a> 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 |
| 454 | causing the Linda to wait out the full operation timeout before cancellation is processed. | 456 | causing the <a href="#lindas">linda</a> to wait out the full operation timeout before cancellation is processed. |
| 455 | </td> | 457 | </td> |
| 456 | </tr> | 458 | </tr> |
| 457 | 459 | ||
| @@ -612,7 +614,7 @@ | |||
| 612 | </p> | 614 | </p> |
| 613 | 615 | ||
| 614 | <hr/> | 616 | <hr/> |
| 615 | <h2 id="creation">Creation</h2> | 617 | <h2 id="creation">Lane Creation</h2> |
| 616 | 618 | ||
| 617 | <p> | 619 | <p> |
| 618 | The following sample shows preparing a function for parallel calling, and calling it with varying arguments. Each of the two results is calculated in a separate OS thread, parallel to the calling one. Reading the results joins the threads, waiting for any results not already there. | 620 | The following sample shows preparing a function for parallel calling, and calling it with varying arguments. Each of the two results is calculated in a separate OS thread, parallel to the calling one. Reading the results joins the threads, waiting for any results not already there. |
| @@ -851,7 +853,7 @@ | |||
| 851 | <td>table</td> | 853 | <td>table</td> |
| 852 | <td> | 854 | <td> |
| 853 | Lists modules that have to be required in order to be able to transfer functions/userdata they exposed. Non-Lua functions are <a href="#function_notes">searched in lookup tables</a>. | 855 | Lists modules that have to be required in order to be able to transfer functions/userdata they exposed. Non-Lua functions are <a href="#function_notes">searched in lookup tables</a>. |
| 854 | These tables are built from the modules listed here. <tt>required</tt> must be an array 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. | 856 | These tables are built from the modules listed here. <tt>required</tt> must be an array of strings, each one being the name of a module to be required. Each module is required with <tt>require()</tt> before the lane function is invoked. |
| 855 | 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. | 857 | 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. |
| 856 | 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). <br /> | 858 | 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). <br /> |
| 857 | ATTEMPTING TO TRANSFER A FUNCTION REGISTERED BY A MODULE NOT LISTED HERE WILL RAISE AN ERROR. | 859 | ATTEMPTING TO TRANSFER A FUNCTION REGISTERED BY A MODULE NOT LISTED HERE WILL RAISE AN ERROR. |
| @@ -865,7 +867,7 @@ | |||
| 865 | <td> | 867 | <td> |
| 866 | Sets the error reporting mode. One of <tt>"minimal"</tt> (the default), <tt>"basic"</tt>, <tt>"extended"</tt>.<br /> | 868 | Sets the error reporting mode. One of <tt>"minimal"</tt> (the default), <tt>"basic"</tt>, <tt>"extended"</tt>.<br /> |
| 867 | <tt>"minimal"</tt> yields only the location of the error.<br /> | 869 | <tt>"minimal"</tt> yields only the location of the error.<br /> |
| 868 | The other 2 yield a full stack trace, with different amounts of data extracted from the debug infos. See <a href="#results">Results</a>. | 870 | The other two options yield a full stack trace, with different amounts of data extracted from the debug infos. See <a href="#results">Results</a>. |
| 869 | </td> | 871 | </td> |
| 870 | </tr> | 872 | </tr> |
| 871 | <tr id=".name" valign=top> | 873 | <tr id=".name" valign=top> |
| @@ -946,7 +948,7 @@ | |||
| 946 | </tr> | 948 | </tr> |
| 947 | </table> | 949 | </table> |
| 948 | 950 | ||
| 949 | Coroutine lanes function mostly like regular coroutines. They can use <tt>coroutine.yield()</tt> normally.<br /> | 951 | Coroutine lanes operate mostly like regular coroutines. They can use <tt>coroutine.yield()</tt> normally.<br /> |
| 950 | A yielded coroutine lane has a <tt>"suspended"</tt> status. It can be resumed with <tt>lane_h:resume(values...), which returns the yielded values</tt>. | 952 | A yielded coroutine lane has a <tt>"suspended"</tt> status. It can be resumed with <tt>lane_h:resume(values...), which returns the yielded values</tt>. |
| 951 | The latter can also be the returned values of <tt>lane_h:join()</tt> or accessed by regular lane indexing (see <a href="#results">Results and errors</a>).<br /> | 953 | The latter can also be the returned values of <tt>lane_h:join()</tt> or accessed by regular lane indexing (see <a href="#results">Results and errors</a>).<br /> |
| 952 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"> | 954 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"> |
| @@ -957,7 +959,7 @@ | |||
| 957 | </tr> | 959 | </tr> |
| 958 | </table> | 960 | </table> |
| 959 | 961 | ||
| 960 | Just like regulare coroutines, the reply values passed to <tt>h:resume()</tt> are returned to the lane body at the <tt>coroutine.yield()</tt> point.<br /> | 962 | Just like regular coroutines, the reply values passed to <tt>h:resume()</tt> are returned to the lane body at the <tt>coroutine.yield()</tt> point.<br /> |
| 961 | If a coroutine lane is suspended when it is joined either by indexing or <tt>lane_h:join()</tt>, active to-be-closed variables are closed at that point, and the Lane can no longer be resumed. | 963 | If a coroutine lane is suspended when it is joined either by indexing or <tt>lane_h:join()</tt>, active to-be-closed variables are closed at that point, and the Lane can no longer be resumed. |
| 962 | </p> | 964 | </p> |
| 963 | <h3>Free running lanes</h3> | 965 | <h3>Free running lanes</h3> |
| @@ -1171,7 +1173,7 @@ | |||
| 1171 | </p> | 1173 | </p> |
| 1172 | 1174 | ||
| 1173 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> | 1175 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> |
| 1174 | [val]= lane_h[1] | 1176 | [val] = lane_h[1] |
| 1175 | </pre></td></tr></table> | 1177 | </pre></td></tr></table> |
| 1176 | 1178 | ||
| 1177 | <p> | 1179 | <p> |
| @@ -1181,7 +1183,7 @@ | |||
| 1181 | </p> | 1183 | </p> |
| 1182 | 1184 | ||
| 1183 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> | 1185 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> |
| 1184 | [true, ...]|[nil,err,stack_tbl]= lane_h:join([timeout]) | 1186 | [true, ...]|[nil,err,stack_tbl] = lane_h:join([timeout]) |
| 1185 | </pre></td></tr></table> | 1187 | </pre></td></tr></table> |
| 1186 | 1188 | ||
| 1187 | <p> | 1189 | <p> |
| @@ -1255,12 +1257,12 @@ | |||
| 1255 | <li> | 1257 | <li> |
| 1256 | <tt>"soft"</tt>: Cancellation will only cause <tt>cancel_test()</tt> to return <tt>"soft"</tt>, so that the lane can cleanup manually. | 1258 | <tt>"soft"</tt>: Cancellation will only cause <tt>cancel_test()</tt> to return <tt>"soft"</tt>, so that the lane can cleanup manually. |
| 1257 | <br /> | 1259 | <br /> |
| 1258 | Lindas will also check for cancellation inside blocking calls to early out based on their <tt>wake_period</tt>. | 1260 | The <a href="#lindas">linda</a> will also check for cancellation inside blocking calls to early out based on its <tt>wake_period</tt>. |
| 1259 | </li> | 1261 | </li> |
| 1260 | <li> | 1262 | <li> |
| 1261 | <tt>"hard"</tt>: waits for the request to be processed, or a timeout to occur. <a href="#lindas">linda</a> operations detecting the cancellation request will raise a special cancellation error (meaning they won't return in that case). | 1263 | <tt>"hard"</tt>: waits for the request to be processed, or a timeout to occur. <a href="#lindas">linda</a> operations detecting the cancellation request will raise a special cancellation error (meaning they won't return in that case). |
| 1262 | <br /> | 1264 | <br /> |
| 1263 | If the lane isn't actually waiting on a Linda when the request is issued, a lane calling <tt>cancel_test()</tt> will see it return <tt>"hard"</tt>. | 1265 | If the lane isn't actually waiting on a <a href="#lindas">linda</a> when the request is issued, a lane calling <tt>cancel_test()</tt> will see it return <tt>"hard"</tt>. |
| 1264 | <br /> | 1266 | <br /> |
| 1265 | <tt>wake_lane</tt> defaults to <tt>true</tt>, and <tt>timeout</tt> defaults to 0 if not specified. | 1267 | <tt>wake_lane</tt> defaults to <tt>true</tt>, and <tt>timeout</tt> defaults to 0 if not specified. |
| 1266 | </li> | 1268 | </li> |
| @@ -1284,7 +1286,7 @@ | |||
| 1284 | <tt>timeout</tt> is an optional number >= 0. Defaults to infinite if left unspecified or <tt>nil</tt>. | 1286 | <tt>timeout</tt> is an optional number >= 0. Defaults to infinite if left unspecified or <tt>nil</tt>. |
| 1285 | </p> | 1287 | </p> |
| 1286 | <p> | 1288 | <p> |
| 1287 | If the lane is still running after the timeout expired, there is a chance lanes will freeze forever at shutdown when failing to terminate all free-running lanes within the specified timeout. | 1289 | If the lane is still running after the timeout expired, there is a chance Lanes will freeze forever at shutdown when failing to terminate all free-running lanes within the specified timeout. |
| 1288 | </p> | 1290 | </p> |
| 1289 | <p> | 1291 | <p> |
| 1290 | Cancellation is tested <u>before</u> going to sleep in <tt>receive()</tt>, <tt>receive_batched()</tt> or <tt>send()</tt> calls and after executing <tt>cancelstep</tt> Lua statements. A pending <tt>receive()</tt>or <tt>send()</tt> call is awakened. | 1292 | Cancellation is tested <u>before</u> going to sleep in <tt>receive()</tt>, <tt>receive_batched()</tt> or <tt>send()</tt> calls and after executing <tt>cancelstep</tt> Lua statements. A pending <tt>receive()</tt>or <tt>send()</tt> call is awakened. |
| @@ -1314,7 +1316,7 @@ | |||
| 1314 | 1316 | ||
| 1315 | <p> | 1317 | <p> |
| 1316 | Lanes registers a function <tt>set_finalizer()</tt> in the lane's Lua state for doing this. | 1318 | Lanes registers a function <tt>set_finalizer()</tt> in the lane's Lua state for doing this. |
| 1317 | Any functions given to it will be called in the lane Lua state, just prior to closing it. It is possible to set more than one finalizer. They are not called in any particular order. | 1319 | Any functions given to it will be called in the lane's Lua state, just prior to closing it. It is possible to set more than one finalizer. They are not called in any particular order. |
| 1318 | </p> | 1320 | </p> |
| 1319 | 1321 | ||
| 1320 | <p> | 1322 | <p> |
| @@ -1390,18 +1392,18 @@ | |||
| 1390 | Registered functions and userdata transiting into a Keeper state are converted to a special dummy closure that holds its actual identity. On transit out, the identity is used to find the real function or userdata in the destination. | 1392 | Registered functions and userdata transiting into a Keeper state are converted to a special dummy closure that holds its actual identity. On transit out, the identity is used to find the real function or userdata in the destination. |
| 1391 | For that reason, it is not possible to run user code inside a Keeper state. The only exception is <a href="#on_state_create"><tt>on_state_create</tt></a>, which is handled in a special way. | 1393 | For that reason, it is not possible to run user code inside a Keeper state. The only exception is <a href="#on_state_create"><tt>on_state_create</tt></a>, which is handled in a special way. |
| 1392 | </li> | 1394 | </li> |
| 1393 | <li>Consuming method is <tt>:receive</tt> (not in).</li> | 1395 | <li>Consuming method is <tt>:receive()</tt> (not in).</li> |
| 1394 | <li>Non-consuming method is <tt>:get</tt> (not rd).</li> | 1396 | <li>Non-consuming method is <tt>:get()</tt> (not rd).</li> |
| 1395 | <li>Two producer-side methods: <tt>:send</tt> and <tt>:set</tt> (not out).</li> | 1397 | <li>Two producer-side methods: <tt>:send()</tt> and <tt>:set()</tt> (not out).</li> |
| 1396 | <li><tt>send</tt> allows for sending multiple values -atomically- to a given slot.</li> | 1398 | <li><tt>send()</tt> allows for sending multiple values -atomically- to a given slot.</li> |
| 1397 | <li><tt>receive</tt> can wait for multiple slots at once.</li> | 1399 | <li><tt>receive()</tt> can wait for multiple slots at once.</li> |
| 1398 | <li><tt>receive_batched</tt> can be used to consume more than one value from a single slot, as in <tt>linda:receive_batched(1.0, "slot", 3, 6).</tt></li> | 1400 | <li><tt>receive_batched()</tt> can be used to consume more than one value from a single slot, as in <tt>linda:receive_batched(1.0, "slot", 3, 6).</tt></li> |
| 1399 | <li><tt>restrict</tt> can restrain a particular slot to function either with <tt>send/receive</tt> or <tt>set/get</tt>.</li> | 1401 | <li><tt>restrict()</tt> can restrain a particular slot to function either with <tt>send()/receive()</tt> or <tt>set()/get()</tt>.</li> |
| 1400 | <li>Individual slots' queue length can be limited, balancing speed differences in a producer/consumer scenario (making <tt>:send</tt> wait).</li> | 1402 | <li>Individual slots' queue length can be limited, balancing speed differences in a producer/consumer scenario (making <tt>:send()</tt> wait).</li> |
| 1401 | <li><tt>tostring(linda)</tt> returns a string of the form <tt>"Linda: <opt_name>"</tt></li> | 1403 | <li><tt>tostring(linda)</tt> returns a string of the form <tt>"Linda: <opt_name>"</tt></li> |
| 1402 | <li> | 1404 | <li> |
| 1403 | Several linda objects may share the same <a href="#keepers">Keeper state</a>. In case there is more than one user <a href="#keepers">Keeper state</a>, assignation must be controlled with the linda's group (an integer in <tt>[0,nb_user_keepers]</tt>). | 1405 | Several linda objects may share the same <a href="#keepers">Keeper state</a>. In case there is more than one user <a href="#keepers">Keeper state</a>, assignation must be controlled with the linda's group (an integer in <tt>[0,nb_user_keepers]</tt>). |
| 1404 | Lanes has an internal linda used for timers and <tt>lanes.wait</tt>; this linda uses group 0. | 1406 | Lanes has an internal linda used for timers and <tt>lanes.wait()</tt>; this linda uses group 0. |
| 1405 | </li> | 1407 | </li> |
| 1406 | <li> | 1408 | <li> |
| 1407 | IMPORTANT: *all* linda operations are wrapped inside a <tt>lua_gc STOP/RESTART</tt> pair. | 1409 | IMPORTANT: *all* linda operations are wrapped inside a <tt>lua_gc STOP/RESTART</tt> pair. |
| @@ -1418,7 +1420,7 @@ | |||
| 1418 | Argument to <tt>lanes.linda()</tt> is either <tt>nil</tt> or a single table. The table may contain the following entries: | 1420 | Argument to <tt>lanes.linda()</tt> is either <tt>nil</tt> or a single table. The table may contain the following entries: |
| 1419 | <ul> | 1421 | <ul> |
| 1420 | <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> | 1422 | <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> |
| 1421 | <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> | 1423 | <li><tt>group</tt>: an integer between 0 and the number of <a href="#keepers">Keeper states</a>. Mandatory if Lanes is configured with more than one <a href="#keepers">Keeper state</a>. Group 0 is used by the internal timer linda.</li> |
| 1422 | <li> | 1424 | <li> |
| 1423 | <tt>name</tt>: a string. Converting the linda to a string will yield the provided name prefixed by <tt>"Linda: "</tt>. | 1425 | <tt>name</tt>: a string. Converting the linda to a string will yield the provided name prefixed by <tt>"Linda: "</tt>. |
| 1424 | 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 /> | 1426 | 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 /> |
| @@ -1451,7 +1453,7 @@ | |||
| 1451 | </pre></td></tr></table> | 1453 | </pre></td></tr></table> |
| 1452 | 1454 | ||
| 1453 | <p> | 1455 | <p> |
| 1454 | It is possible to restrict a particular slot in a Linda to either <tt>send/receive</tt> or <tt>set/get</tt> operations.<br /> | 1456 | It is possible to restrict a particular slot in a Linda to either <tt>send()/receive()</tt> or <tt>set()/get()</tt> operations.<br /> |
| 1455 | Possible modes are <tt>"none"</tt>, <tt>"set/get"</tt> or <tt>"send/receive"</tt>.<br /> | 1457 | Possible modes are <tt>"none"</tt>, <tt>"set/get"</tt> or <tt>"send/receive"</tt>.<br /> |
| 1456 | If a new mode is specified, <tt>restrict()</tt> updates the mode and returns the previous one.<br /> | 1458 | If a new mode is specified, <tt>restrict()</tt> updates the mode and returns the previous one.<br /> |
| 1457 | If no mode is specified, <tt>restrict()</tt> does nothing and returns the current mode.<br /> | 1459 | If no mode is specified, <tt>restrict()</tt> does nothing and returns the current mode.<br /> |
| @@ -1558,7 +1560,8 @@ | |||
| 1558 | </pre></td></tr></table> | 1560 | </pre></td></tr></table> |
| 1559 | 1561 | ||
| 1560 | <p> | 1562 | <p> |
| 1561 | Forces a full garbage collect cycle inside the Keeper state assigned to the Linda (same as <tt>lua_gc(L, LUA_GCCOLLECT)</tt>).<br /> | 1563 | Forces a full garbage collect cycle inside the <a href="#keepers">Keeper state</a> assigned to the linda (same as <tt>lua_gc(L, LUA_GCCOLLECT)</tt>).<br /> |
| 1564 | All lindas sharing the same <a href="#keepers">Keeper state</a> will have to wait for the operation to complete before being able to resume regular service.<br /> | ||
| 1562 | Can be useful to clean stale storage after some keys are cleaned. | 1565 | Can be useful to clean stale storage after some keys are cleaned. |
| 1563 | </p> | 1566 | </p> |
| 1564 | 1567 | ||
| @@ -1682,7 +1685,7 @@ | |||
| 1682 | </p> | 1685 | </p> |
| 1683 | 1686 | ||
| 1684 | <p> | 1687 | <p> |
| 1685 | Once a timer expires, the <tt>slot</tt> is set with the current time (in seconds, same offset as <tt>os.time()</tt> but with millisecond accuracy). The slot can be waited upon using the regular <a href="#lindas">linda</a> <tt>:receive()</tt> method. | 1688 | Once a timer expires, the <tt>slot</tt> is set with the current time (in seconds, same offset as <tt>os.time()</tt> but with millisecond accuracy). The slot can be waited upon using the regular <tt><a href="#lindas">linda</a>:receive()</tt> method. |
| 1686 | </p> | 1689 | </p> |
| 1687 | 1690 | ||
| 1688 | <p> | 1691 | <p> |
| @@ -1722,7 +1725,7 @@ | |||
| 1722 | <td> | 1725 | <td> |
| 1723 | <font size="-1"> | 1726 | <font size="-1"> |
| 1724 | Having the API as <tt>lanes.timer()</tt> is intentional. Another alternative would be <tt>linda_h:timer()</tt> but timers are not traditionally seen to be part of lindas. Also, it would mean any lane getting a <a href="#lindas">linda</a> handle would be able to modify timers on it. | 1727 | Having the API as <tt>lanes.timer()</tt> is intentional. Another alternative would be <tt>linda_h:timer()</tt> but timers are not traditionally seen to be part of lindas. Also, it would mean any lane getting a <a href="#lindas">linda</a> handle would be able to modify timers on it. |
| 1725 | A third choice could be abstracting the timers out of <a href="#lindas">linda</a> realm altogether (<tt>timer_h= lanes.timer(date|first_secs, period_secs )</tt>) but that would mean separate waiting functions for timers, and lindas. | 1728 | A third choice could be abstracting the timers out of <a href="#lindas">linda</a> realm altogether (<tt>timer_h = lanes.timer(date|first_secs, period_secs )</tt>) but that would mean separate waiting functions for timers, and lindas. |
| 1726 | Even if a <a href="#lindas">linda</a> object and slot was returned, that slot couldn't be waited upon simultaneously with one's general <a href="#lindas">linda</a> events. | 1729 | Even if a <a href="#lindas">linda</a> object and slot was returned, that slot couldn't be waited upon simultaneously with one's general <a href="#lindas">linda</a> events. |
| 1727 | The current system gives maximum capabilities with minimum API, and any smoothenings can easily be crafted in Lua at the application level. | 1730 | The current system gives maximum capabilities with minimum API, and any smoothenings can easily be crafted in Lua at the application level. |
| 1728 | </font> | 1731 | </font> |
| @@ -2059,8 +2062,8 @@ static MyDeepFactory g_MyDeepFactory; | |||
| 2059 | </p> | 2062 | </p> |
| 2060 | 2063 | ||
| 2061 | <p> | 2064 | <p> |
| 2062 | Pay attention to the fact a deep userdata last proxy can be held inside a Keeper state after being stored in a Linda and all other references are lost. | 2065 | Pay attention to the fact a deep userdata last proxy can be held inside a <a href="#keepers">Keeper state</a> after being stored in a <a href="#lindas">linda</a> and all other references are lost. |
| 2063 | If the Linda then flushes its contents through garbage collection in the Keeper state or by being collected itself, it means that <tt>deleteDeepObjectInternal()</tt> can be called from inside a Keeper state. | 2066 | If the <a href="#lindas">linda</a> then flushes its contents through garbage collection in the <a href="#keepers">Keeper state</a> or by being collected itself, it means that <tt>deleteDeepObjectInternal()</tt> can be called from inside a <a href="#keepers">Keeper state</a>. |
| 2064 | </p> | 2067 | </p> |
| 2065 | 2068 | ||
| 2066 | <p> | 2069 | <p> |
