diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2026-02-26 11:02:55 +0100 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2026-02-26 11:02:55 +0100 |
| commit | 4f97720e4c3944ccf9b9742028dc697c2dd94c5a (patch) | |
| tree | 259ec6c30971f3ca0c7e0f38898ab7f7aa548af9 /docs/index.html | |
| parent | 6b8c83b3bc44b0a1bc186f58de0fea6dfc214c4b (diff) | |
| download | lanes-4f97720e4c3944ccf9b9742028dc697c2dd94c5a.tar.gz lanes-4f97720e4c3944ccf9b9742028dc697c2dd94c5a.tar.bz2 lanes-4f97720e4c3944ccf9b9742028dc697c2dd94c5a.zip | |
change cancel_test() to raise cancel_error on hard-cancels by default
Diffstat (limited to 'docs/index.html')
| -rw-r--r-- | docs/index.html | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/docs/index.html b/docs/index.html index 3dc2b61..11ed3eb 100644 --- a/docs/index.html +++ b/docs/index.html | |||
| @@ -65,13 +65,13 @@ | |||
| 65 | <font size="-1"> | 65 | <font size="-1"> |
| 66 | <p> | 66 | <p> |
| 67 | <br /> | 67 | <br /> |
| 68 | <i>Copyright © 2007-25 Asko Kauppi, Benoit Germain. All rights reserved.</i> | 68 | <i>Copyright © 2007-26 Asko Kauppi, Benoit Germain. All rights reserved.</i> |
| 69 | <br /> | 69 | <br /> |
| 70 | 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, 5.4 and 5.5. | 70 | 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, 5.4 and 5.5. |
| 71 | </p> | 71 | </p> |
| 72 | 72 | ||
| 73 | <p> | 73 | <p> |
| 74 | This document was revised on 29-Sep-2025, and applies to version <tt>4.0.0</tt>. | 74 | This document was revised on 26-Feb-2026, and applies to version <tt>4.0.0</tt>. |
| 75 | </p> | 75 | </p> |
| 76 | </font> | 76 | </font> |
| 77 | </center> | 77 | </center> |
| @@ -1200,7 +1200,7 @@ | |||
| 1200 | <li><tt>"extended"</tt>: <tt>stack_tbl</tt> is an array of tables containing info gathered with <tt>lua_getinfo()</tt> (<tt>"source"</tt>,<tt>"currentline"</tt>,<tt>"name"</tt>,<tt>"namewhat"</tt>,<tt>"what"</tt>).</li> | 1200 | <li><tt>"extended"</tt>: <tt>stack_tbl</tt> is an array of tables containing info gathered with <tt>lua_getinfo()</tt> (<tt>"source"</tt>,<tt>"currentline"</tt>,<tt>"name"</tt>,<tt>"namewhat"</tt>,<tt>"what"</tt>).</li> |
| 1201 | </ul> | 1201 | </ul> |
| 1202 | </li> | 1202 | </li> |
| 1203 | <li><tt>nil, "killed"</tt> if forcefully killed.</li> | 1203 | <li><tt>nil, lanes.cancel_error</tt> if <tt>"hard"</tt>-cancelled during a <a href="#lindas">linda</a> operation (which is nothing more than a special case of the above).</li> |
| 1204 | <li><tt>true [, returned-values]</tt>: The return values of the lane function.</li> | 1204 | <li><tt>true [, returned-values]</tt>: The return values of the lane function.</li> |
| 1205 | </ul> | 1205 | </ul> |
| 1206 | If the lane handle obtained from <tt>lanes.gen()</tt> is to-be-closed, closing the value will cause a call to <tt>join()</tt>. | 1206 | If the lane handle obtained from <tt>lanes.gen()</tt> is to-be-closed, closing the value will cause a call to <tt>join()</tt>. |
| @@ -1262,14 +1262,14 @@ | |||
| 1262 | <li> | 1262 | <li> |
| 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). | 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). |
| 1264 | <br /> | 1264 | <br /> |
| 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>. | 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 also raise <tt>lanes.cancel_error</tt>, unless <tt>cancel_test(true)</tt> is used, in which case it returns <tt>"hard"</tt> instead. |
| 1266 | <br /> | 1266 | <br /> |
| 1267 | <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 infinite if not specified. |
| 1268 | </li> | 1268 | </li> |
| 1269 | <li> | 1269 | <li> |
| 1270 | <tt>"call"</tt>, <tt>"ret"</tt>, <tt>"line"</tt>, <tt>"count"</tt>: Asynchronously install the corresponding hook, then behave as <tt>"hard"</tt>. | 1270 | <tt>"call"</tt>, <tt>"ret"</tt>, <tt>"line"</tt>, <tt>"count"</tt>: Asynchronously install the corresponding hook, then behave as <tt>"hard"</tt>. |
| 1271 | <br /> | 1271 | <br /> |
| 1272 | If the lane has the opportunity to call <tt>cancel_test()</tt> before the hook is invoked, calling <tt>cancel_test()</tt> will see it return <tt>"hard"</tt>. | 1272 | If the lane has the opportunity to call <tt>cancel_test()</tt> before the hook is invoked, it will also raise <tt>lanes.cancel_error</tt> (or return <tt>"hard"</tt> if <tt>cancel_test(true)</tt> is used). |
| 1273 | </li> | 1273 | </li> |
| 1274 | <li> | 1274 | <li> |
| 1275 | <tt>"all"</tt>: Installs all hooks in one shot, just to be sure. | 1275 | <tt>"all"</tt>: Installs all hooks in one shot, just to be sure. |
| @@ -1297,10 +1297,15 @@ | |||
| 1297 | </p> | 1297 | </p> |
| 1298 | 1298 | ||
| 1299 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> | 1299 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> |
| 1300 | false|"soft"|"hard" = cancel_test() -- inside the lane | 1300 | false|"soft" = cancel_test() -- raises cancel_error on hard cancel |
| 1301 | false|"soft"|"hard" = cancel_test(true) -- returns "hard" instead of raising | ||
| 1301 | </pre></td></tr></table> | 1302 | </pre></td></tr></table> |
| 1302 | <p> | 1303 | <p> |
| 1303 | Lanes installs the function <tt>cancel_test()</tt> in each created lane to manually test for cancel requests. | 1304 | Lanes installs the function <tt>cancel_test()</tt> in each created lane to manually test for cancel requests. |
| 1305 | It returns <tt>false</tt> when no cancel is pending, <tt>"soft"</tt> on a soft cancel request, and raises | ||
| 1306 | <tt>lanes.cancel_error</tt> on a hard cancel request. Passing <tt>true</tt> as the optional argument suppresses | ||
| 1307 | the raise and returns <tt>"hard"</tt> instead, which is useful when the lane needs to distinguish the cancel | ||
| 1308 | mode before deciding how to react. | ||
| 1304 | </p> | 1309 | </p> |
| 1305 | 1310 | ||
| 1306 | <!-- finalizers +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 1311 | <!-- finalizers +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
