diff options
Diffstat (limited to 'docs/index.html')
-rw-r--r-- | docs/index.html | 151 |
1 files changed, 123 insertions, 28 deletions
diff --git a/docs/index.html b/docs/index.html index 116fc0a..2e74495 100644 --- a/docs/index.html +++ b/docs/index.html | |||
@@ -38,6 +38,7 @@ | |||
38 | <a href="#description">Description</a> · | 38 | <a href="#description">Description</a> · |
39 | <a href="#systems">Supported systems</a> · | 39 | <a href="#systems">Supported systems</a> · |
40 | <a href="#installing">Building and Installing</a> · | 40 | <a href="#installing">Building and Installing</a> · |
41 | <a href="#apicheatsheet">API Cheat sheet</a> | ||
41 | <a href="#embedding">Embedding</a> | 42 | <a href="#embedding">Embedding</a> |
42 | </p> | 43 | </p> |
43 | 44 | ||
@@ -66,11 +67,11 @@ | |||
66 | <br /> | 67 | <br /> |
67 | <i>Copyright © 2007-25 Asko Kauppi, Benoit Germain. All rights reserved.</i> | 68 | <i>Copyright © 2007-25 Asko Kauppi, Benoit Germain. All rights reserved.</i> |
68 | <br /> | 69 | <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. | 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 | </p> | 71 | </p> |
71 | 72 | ||
72 | <p> | 73 | <p> |
73 | This document was revised on 18-Apr-25, and applies to version <tt>4.0.0</tt>. | 74 | This document was revised on 03-Jul-25, and applies to version <tt>4.0.0</tt>. |
74 | </p> | 75 | </p> |
75 | </font> | 76 | </font> |
76 | </center> | 77 | </center> |
@@ -88,7 +89,7 @@ | |||
88 | Lanes is included into your software by the regular <tt>require "lanes"</tt> method. No C side programming is needed; all APIs are Lua side, and most existing extension modules should work seamlessly together with the multiple lanes. | 89 | Lanes is included into your software by the regular <tt>require "lanes"</tt> method. No C side programming is needed; all APIs are Lua side, and most existing extension modules should work seamlessly together with the multiple lanes. |
89 | </p> | 90 | </p> |
90 | <p> | 91 | <p> |
91 | Lanes should build and run identically with either Lua 5.1 to Lua 5.4, as well as LuaJIT. | 92 | Lanes should build and run identically with either Lua 5.1 to Lua 5.5, as well as LuaJIT. |
92 | </p> | 93 | </p> |
93 | <p> | 94 | <p> |
94 | See <A HREF="comparison.html">comparison</A> of Lua Lanes with other Lua multithreading solutions. | 95 | See <A HREF="comparison.html">comparison</A> of Lua Lanes with other Lua multithreading solutions. |
@@ -105,7 +106,7 @@ | |||
105 | <li>Threads can be given priorities.</li> | 106 | <li>Threads can be given priorities.</li> |
106 | <li>Lanes are cancellable, with proper cleanup.</li> | 107 | <li>Lanes are cancellable, with proper cleanup.</li> |
107 | <li>No Lua-side application level locking - ever!</li> | 108 | <li>No Lua-side application level locking - ever!</li> |
108 | <li>Several totally independant Lanes universes may coexist in an application, one per "master" Lua state.</li> | 109 | <li>Several totally independent Lanes universes may coexist in an application, one per "master" Lua state.</li> |
109 | </ul> | 110 | </ul> |
110 | 111 | ||
111 | 112 | ||
@@ -116,7 +117,7 @@ | |||
116 | <li>Sharing full userdata between states needs special C side preparations (-> <A HREF="#deep_userdata">deep userdata</A> and -> <A HREF="#clonable_userdata">clonable userdata</A>).</li> | 117 | <li>Sharing full userdata between states needs special C side preparations (-> <A HREF="#deep_userdata">deep userdata</A> and -> <A HREF="#clonable_userdata">clonable userdata</A>).</li> |
117 | <li>Network level parallelism not included.</li> | 118 | <li>Network level parallelism not included.</li> |
118 | <li>Multi-CPU is done with OS threads, not processes. A lane is a Lua full userdata, therefore it will exist only as long as the Lua state that created it still exists. Therefore, a lane won't continue execution after the main program's termination.</li> | 119 | <li>Multi-CPU is done with OS threads, not processes. A lane is a Lua full userdata, therefore it will exist only as long as the Lua state that created it still exists. Therefore, a lane won't continue execution after the main program's termination.</li> |
119 | <li>Just like independant Lua states, Lanes universes cannot communicate together.</li> | 120 | <li>Just like independent Lua states, Lanes universes cannot communicate together.</li> |
120 | </ul> | 121 | </ul> |
121 | </p> | 122 | </p> |
122 | 123 | ||
@@ -169,6 +170,84 @@ | |||
169 | </pre> | 170 | </pre> |
170 | 171 | ||
171 | 172 | ||
173 | <!-- API reference +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
174 | <hr/> | ||
175 | <h2 id="apicheatsheet">API Cheat sheet</h2> | ||
176 | <ul> | ||
177 | <li> | ||
178 | <tt>require "lanes"</tt>: to require Lanes | ||
179 | </li> | ||
180 | <li> | ||
181 | The <tt>lanes</tt> module | ||
182 | <ul> | ||
183 | <li><tt>lanes.cancel_error</tt>: a special error value returned from cancelled lanes</li> | ||
184 | <li><tt>lanes.collectgarbage()</tt>: trigger a GC cycle in all Keeper states</li> | ||
185 | <li><tt>lanes.configure()</tt>: configure Lanes</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> | ||
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> | ||
190 | <li><tt>lanes.genlock()</tt>: obtain an atomic-like data stack</li> | ||
191 | <li><tt>lanes.linda()</tt>: create a Linda</li> | ||
192 | <li><tt>lanes.nameof()</tt>: find where a value exists</li> | ||
193 | <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.register()</tt>: scan modules so that functions using them can be transferred</li> | ||
196 | <li><tt>lanes.set_thread_priority()</tt>: change thread priority</li> | ||
197 | <li><tt>lanes.set_thread_affinity()</tt>: change thread affinity</li> | ||
198 | <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.timer()</tt>: start a timer</li> | ||
201 | <li><tt>lanes.timers()</tt>: list active timers</li> | ||
202 | </ul> | ||
203 | </li> | ||
204 | <li> | ||
205 | Given some lane handle <tt>lane_h</tt> | ||
206 | <ul> | ||
207 | <li><tt>lane_h[]</tt>: wait for, and read the values returned by the lane</li> | ||
208 | <li><tt>lane_h:cancel()</tt>: request the lane to stop running</li> | ||
209 | <li><tt>lane_h.error_trace_level</tt>: current setting of error logging level</li> | ||
210 | <li><tt>lane_h:get_threadname()</tt>: read the thread name</li> | ||
211 | <li><tt>lane_h:join()</tt>: wait for the lane to close, reading the returned values</li> | ||
212 | <li><tt>lane_h:resume()</tt>: resume a coroutine Lane</li> | ||
213 | <li><tt>lane_h.status</tt>: current status of the lane</li> | ||
214 | </ul> | ||
215 | </li> | ||
216 | <li> | ||
217 | Inside the lane | ||
218 | <ul> | ||
219 | <li><tt>cancel_test()</tt>: check for cancellation requests</li> | ||
220 | <li><tt>lane_threadname()</tt>: read or change the name of the thread</li> | ||
221 | <li><tt>set_finalizer()</tt>: install a function called when the lane exits</li> | ||
222 | </ul> | ||
223 | </li> | ||
224 | <li> | ||
225 | Given some Linda <tt>l</tt> | ||
226 | <ul> | ||
227 | <li><tt>l:cancel()</tt>: mark a Linda for cancellation</li> | ||
228 | <li><tt>l:collectgarbage()</tt>: trigger a GC cycle in the Linda's Keeper state</li> | ||
229 | <li><tt>l:deep()</tt>: obtain a light userdata uniquely representing the Linda</li> | ||
230 | <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> | ||
232 | <li><tt>l:get()</tt>: read data without consuming it</li> | ||
233 | <li><tt>l:limit()</tt>: cap the amount of transiting data</li> | ||
234 | <li><tt>l:receive()</tt>: read one item of data from multiple slots</li> | ||
235 | <li><tt>l:receive_batched()</tt>: read several item of data from a single slot</li> | ||
236 | <li><tt>l:restrict()</tt>: place a restraint on the operations that can be done on a slot</li> | ||
237 | <li><tt>l:send()</tt>: append data</li> | ||
238 | <li><tt>l:set()</tt>: replace the data</li> | ||
239 | <li><tt>l:wake()</tt>: manually wake blocking calls</li> | ||
240 | </ul> | ||
241 | </li> | ||
242 | <li> | ||
243 | embedding | ||
244 | <ul> | ||
245 | <li><tt>luaopen_lanes_embedded</tt>: manually initialize Lanes</li> | ||
246 | </ul> | ||
247 | </li> | ||
248 | </ul> | ||
249 | |||
250 | |||
172 | <!-- embedding +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 251 | <!-- embedding +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
173 | <hr/> | 252 | <hr/> |
174 | <h2 id="embedding">Embedding</h2> | 253 | <h2 id="embedding">Embedding</h2> |
@@ -785,12 +864,13 @@ | |||
785 | </tr> | 864 | </tr> |
786 | <tr valign=top> | 865 | <tr valign=top> |
787 | <td> | 866 | <td> |
788 | <code>.priority</code> | 867 | <code>.priority</code><br /> |
868 | <code>.native_priority</code> | ||
789 | </td> | 869 | </td> |
790 | <td>integer</td> | 870 | <td>integer</td> |
791 | <td> | 871 | <td> |
792 | The priority of lanes generated in the range -3..+3 (default is 0). | 872 | <tt>priority</tt>: The priority of lanes in the range <tt>[-3,+3]</tt> (default is 0). These values are a mapping over the actual priority range of the underlying implementation.<br /> |
793 | These values are a mapping over the actual priority range of the underlying implementation.<br /> | 873 | <tt>native_priority</tt>: The priority of lanes in a platform-dependent range. Use <a href="#priority"><tt>lanes.thread_priority_range()</tt></a> to query said range. |
794 | Implementation and dependability of priorities varies by platform. Especially Linux kernel 2.6 is not supporting priorities in user mode.<br /> | 874 | Implementation and dependability of priorities varies by platform. Especially Linux kernel 2.6 is not supporting priorities in user mode.<br /> |
795 | A lane can also change its own thread priority dynamically with <a href="#priority"><tt>lanes.set_thread_priority()</tt></a>. | 875 | A lane can also change its own thread priority dynamically with <a href="#priority"><tt>lanes.set_thread_priority()</tt></a>. |
796 | </td> | 876 | </td> |
@@ -813,7 +893,7 @@ | |||
813 | The name is stored inside the Lua state registry so that it is available for error reporting. Changing <tt>decoda_name</tt> doesn't affect this hidden name or the OS thread name reported by MSVC.<br /> | 893 | The name is stored inside the Lua state registry so that it is available for error reporting. Changing <tt>decoda_name</tt> doesn't affect this hidden name or the OS thread name reported by MSVC.<br /> |
814 | When Lanes is initialized by the first <a href="#initialization"><tt>lanes.configure()</tt></a> call, <tt>"main"</tt> is stored in the registry in the same fashion (but <tt>decoda_name</tt> and the OS thread name are left unchanged).<br /> | 894 | When Lanes is initialized by the first <a href="#initialization"><tt>lanes.configure()</tt></a> call, <tt>"main"</tt> is stored in the registry in the same fashion (but <tt>decoda_name</tt> and the OS thread name are left unchanged).<br /> |
815 | The lane also has a method <tt>lane:get_threadname()</tt> that gives access to that name from the caller side (returns <tt>"<unnamed>"</tt> if unset).<br /> | 895 | The lane also has a method <tt>lane:get_threadname()</tt> that gives access to that name from the caller side (returns <tt>"<unnamed>"</tt> if unset).<br /> |
816 | With Lua 5.4, Lanes have a <tt>__close</tt> metamethod, meaning they can be declared to-be-closed. <tt>__close</tt> calls <tt>lane:join(nil)</tt>. | 896 | With Lua 5.4+, Lanes have a <tt>__close</tt> metamethod, meaning they can be declared to-be-closed. <tt>__close</tt> calls <tt>lane:join(nil)</tt>. |
817 | </p> | 897 | </p> |
818 | 898 | ||
819 | <p> | 899 | <p> |
@@ -842,8 +922,9 @@ | |||
842 | </tr> | 922 | </tr> |
843 | </table> | 923 | </table> |
844 | 924 | ||
845 | Coroutine lanes function mostly like regular coroutines. They can use <tt>coroutine.yield()</tt> normally, in which case the yielded values can be obtained with regular lane indexing (see <a href="#results">Results and errors</a>).<br /> | 925 | Coroutine lanes function mostly like regular coroutines. They can use <tt>coroutine.yield()</tt> normally.<br /> |
846 | A yielded coroutine lane has a <tt>"suspended"</tt> status. It can be resumed with <tt>lane_h:resume(values...)</tt>. | 926 | 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>. |
927 | 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 /> | ||
847 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"> | 928 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"> |
848 | <tr> | 929 | <tr> |
849 | <td> | 930 | <td> |
@@ -852,8 +933,8 @@ | |||
852 | </tr> | 933 | </tr> |
853 | </table> | 934 | </table> |
854 | 935 | ||
855 | The reply values are returned to the lane body at the <tt>coroutine.yield()</tt> point.<br /> | 936 | 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 /> |
856 | If the yielded values were previously obtained by lane indexing, <tt>resume()</tt> returns <tt>nil</tt>. | 937 | 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. |
857 | </p> | 938 | </p> |
858 | <h3>Free running lanes</h3> | 939 | <h3>Free running lanes</h3> |
859 | 940 | ||
@@ -879,14 +960,17 @@ | |||
879 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"> | 960 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"> |
880 | <tr> | 961 | <tr> |
881 | <td> | 962 | <td> |
882 | <pre> lanes.set_thread_priority(prio)</pre> | 963 | <pre> prio_min, prio_max = lanes.thread_priority_range(prio [,"native"])</pre> |
964 | <pre> lanes.set_thread_priority(prio [,"native"])</pre> | ||
883 | </td> | 965 | </td> |
884 | </tr> | 966 | </tr> |
885 | </table> | 967 | </table> |
886 | <p> | 968 | <p> |
887 | Besides setting a default priority in the generator <a href="#generator_settings">settings</a>, each thread can change its own priority at will. This is also true for the main Lua state. | 969 | Besides setting a default priority in the generator <a href="#generator_settings">settings</a>, each thread can change its own priority at will. This is also true for the main Lua state. |
888 | <br /> | 970 | <br /> |
889 | The priority must be in the range <tt>[-3,+3]</tt>. | 971 | <tt>lanes.thread_priority_range()</tt> returns the range of acceptable mapped values. If nothing is specified, should be <tt>[-3,3]</tt> or <tt>[0,3]</tt>, depending on the threading implementation. |
972 | <br /> | ||
973 | <tt>lanes.thread_priority_range('native')</tt> returns the range of acceptable native values. The actual values are threading implementation dependent. And some implementations can only accept some values inside that range. YMMV. | ||
890 | </p> | 974 | </p> |
891 | 975 | ||
892 | 976 | ||
@@ -1073,7 +1157,7 @@ | |||
1073 | </p> | 1157 | </p> |
1074 | 1158 | ||
1075 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> | 1159 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> |
1076 | [...]|[nil,err,stack_tbl]= lane_h:join([timeout]) | 1160 | [true, ...]|[nil,err,stack_tbl]= lane_h:join([timeout]) |
1077 | </pre></td></tr></table> | 1161 | </pre></td></tr></table> |
1078 | 1162 | ||
1079 | <p> | 1163 | <p> |
@@ -1091,9 +1175,9 @@ | |||
1091 | </ul> | 1175 | </ul> |
1092 | </li> | 1176 | </li> |
1093 | <li><tt>nil, "killed"</tt> if forcefully killed.</li> | 1177 | <li><tt>nil, "killed"</tt> if forcefully killed.</li> |
1094 | <li>The return values of the lane function. If the first return value is <tt>nil</tt> (or there is no return value), an error is raised, to make sure you can tell timeout and error cases apart from successful return.</li> | 1178 | <li><tt>true [, returned-values]</tt>: The return values of the lane function.</li> |
1095 | </ul> | 1179 | </ul> |
1096 | 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>. Since it is implicit, the lane body isn't forced to return non-<tt>nil</tt> in that case. | 1180 | 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>. |
1097 | </p> | 1181 | </p> |
1098 | 1182 | ||
1099 | <table border=1 bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> | 1183 | <table border=1 bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> |
@@ -1137,38 +1221,49 @@ | |||
1137 | </pre></td></tr></table> | 1221 | </pre></td></tr></table> |
1138 | 1222 | ||
1139 | <p> | 1223 | <p> |
1140 | <tt>timeout</tt> is an optional number >= 0. Defaults to infinite if left unspecified or <tt>nil</tt>. | ||
1141 | <br /> | ||
1142 | <tt>cancel()</tt> sends a cancellation request to the lane. | 1224 | <tt>cancel()</tt> sends a cancellation request to the lane. |
1143 | <br /> | 1225 | <p> |
1144 | First argument is a <tt>mode</tt> can be one of: | 1226 | Returns <tt>true, lane_h.status</tt> if lane was already done (in <tt>"done"</tt>, <tt>"error"</tt> or <tt>"cancelled"</tt> status), or the cancellation was fruitful within <tt>timeout_secs</tt> timeout period.<br /> |
1227 | Returns <tt>false, "timeout"</tt> otherwise. | ||
1228 | </p> | ||
1229 | First argument is a <tt>mode</tt>. It can be one of: | ||
1145 | <ul> | 1230 | <ul> |
1146 | <li> | 1231 | <li> |
1147 | <tt>"soft"</tt>: Cancellation will only cause <tt>cancel_test()</tt> to return <tt>true</tt>, so that the lane can cleanup manually. | 1232 | <tt>"soft"</tt>: Cancellation will only cause <tt>cancel_test()</tt> to return <tt>"soft"</tt>, so that the lane can cleanup manually. |
1233 | <br /> | ||
1234 | Lindas will also check for cancellation inside blocking calls to early out based on their <tt>wake_period</tt>. | ||
1148 | </li> | 1235 | </li> |
1149 | <li> | 1236 | <li> |
1150 | <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).<br /> | 1237 | <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). |
1238 | <br /> | ||
1239 | 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>. | ||
1240 | <br /> | ||
1151 | <tt>wake_lane</tt> defaults to <tt>true</tt>, and <tt>timeout</tt> defaults to 0 if not specified. | 1241 | <tt>wake_lane</tt> defaults to <tt>true</tt>, and <tt>timeout</tt> defaults to 0 if not specified. |
1152 | </li> | 1242 | </li> |
1153 | <li> | 1243 | <li> |
1154 | <tt>"call"</tt>, <tt>"ret"</tt>, <tt>"line"</tt>, <tt>"count"</tt>: Asynchronously install the corresponding hook, then behave as <tt>"hard"</tt>. | 1244 | <tt>"call"</tt>, <tt>"ret"</tt>, <tt>"line"</tt>, <tt>"count"</tt>: Asynchronously install the corresponding hook, then behave as <tt>"hard"</tt>. |
1245 | <br /> | ||
1246 | 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>. | ||
1155 | </li> | 1247 | </li> |
1156 | <li> | 1248 | <li> |
1157 | <tt>"all"</tt>: Installs all hooks in one shot, just to be sure. | 1249 | <tt>"all"</tt>: Installs all hooks in one shot, just to be sure. |
1158 | </li> | 1250 | </li> |
1159 | </ul> | 1251 | </ul> |
1160 | If <tt>mode</tt> is not specified, it defaults to <tt>"hard"</tt>. | 1252 | <p> |
1253 | If <tt>mode</tt> is not specified, it defaults to <tt>"hard"</tt>. | ||
1254 | </p> | ||
1255 | </p> | ||
1256 | <p> | ||
1161 | If <tt>wake_lane</tt> is <tt>true</tt>, the lane is also signalled so that execution returns from any pending <a href="#lindas">linda</a> operation. <a href="#lindas">linda</a> operations detecting the cancellation request return <tt>lanes.cancel_error</tt>. | 1257 | If <tt>wake_lane</tt> is <tt>true</tt>, the lane is also signalled so that execution returns from any pending <a href="#lindas">linda</a> operation. <a href="#lindas">linda</a> operations detecting the cancellation request return <tt>lanes.cancel_error</tt>. |
1162 | </p> | 1258 | </p> |
1163 | <p> | 1259 | <p> |
1164 | Returns <tt>true, lane_h.status</tt> if lane was already done (in <tt>"done"</tt>, <tt>"error"</tt> or <tt>"cancelled"</tt> status), or the cancellation was fruitful within <tt>timeout_secs</tt> timeout period.<br /> | 1260 | <tt>timeout</tt> is an optional number >= 0. Defaults to infinite if left unspecified or <tt>nil</tt>. |
1165 | Returns <tt>false, "timeout"</tt> otherwise. | ||
1166 | </p> | 1261 | </p> |
1167 | <p> | 1262 | <p> |
1168 | 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. | 1263 | 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. |
1169 | </p> | 1264 | </p> |
1170 | <p> | 1265 | <p> |
1171 | 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. A pending <tt>receive()</tt>or <tt>send()</tt> call is awakened. | 1266 | 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. |
1172 | <br /> | 1267 | <br /> |
1173 | 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). | 1268 | 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). |
1174 | <br /> | 1269 | <br /> |