diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2025-05-07 15:43:01 +0200 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2025-05-07 15:43:01 +0200 |
commit | 074a7157b6bd3867b60d04f685cdede6063e6e3c (patch) | |
tree | 21f58c5c739fadaaa57b214e468524efbbe26cbb /docs/index.html | |
parent | d0dd3b644b36bac119aa9e9da40c3cfe38a6e234 (diff) | |
download | lanes-master.tar.gz lanes-master.tar.bz2 lanes-master.zip |
* thread priorities can now be set using the native range of values, if desired.
* thread API errors cause a Lua error instead of aborting the program.
* new function lanes.thread_priority_range(), to query the valid range of priorities.
* unit tests for all of the above
Diffstat (limited to 'docs/index.html')
-rw-r--r-- | docs/index.html | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/docs/index.html b/docs/index.html index e3fbd0b..be8ad7f 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 23-Apr-25, and applies to version <tt>4.0.0</tt>. | 74 | This document was revised on 07-May-25, and applies to version <tt>4.0.0</tt>. |
75 | </p> | 75 | </p> |
76 | </font> | 76 | </font> |
77 | </center> | 77 | </center> |
@@ -106,7 +106,7 @@ | |||
106 | <li>Threads can be given priorities.</li> | 106 | <li>Threads can be given priorities.</li> |
107 | <li>Lanes are cancellable, with proper cleanup.</li> | 107 | <li>Lanes are cancellable, with proper cleanup.</li> |
108 | <li>No Lua-side application level locking - ever!</li> | 108 | <li>No Lua-side application level locking - ever!</li> |
109 | <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> |
110 | </ul> | 110 | </ul> |
111 | 111 | ||
112 | 112 | ||
@@ -117,7 +117,7 @@ | |||
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>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> |
118 | <li>Network level parallelism not included.</li> | 118 | <li>Network level parallelism not included.</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>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> |
120 | <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> |
121 | </ul> | 121 | </ul> |
122 | </p> | 122 | </p> |
123 | 123 | ||
@@ -190,6 +190,7 @@ | |||
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 Linda</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.thread_priority_range()</tt>: obtain the valid range of thread priorities</li> | ||
193 | <li><tt>lanes.now_secs()</tt>: obtain the current clock value</li> | 194 | <li><tt>lanes.now_secs()</tt>: obtain the current clock value</li> |
194 | <li><tt>lanes.register()</tt>: scan modules so that functions using them can be transferred</li> | 195 | <li><tt>lanes.register()</tt>: scan modules so that functions using them can be transferred</li> |
195 | <li><tt>lanes.set_thread_priority()</tt>: change thread priority</li> | 196 | <li><tt>lanes.set_thread_priority()</tt>: change thread priority</li> |
@@ -863,12 +864,13 @@ | |||
863 | </tr> | 864 | </tr> |
864 | <tr valign=top> | 865 | <tr valign=top> |
865 | <td> | 866 | <td> |
866 | <code>.priority</code> | 867 | <code>.priority</code><br /> |
868 | <code>.native_priority</code> | ||
867 | </td> | 869 | </td> |
868 | <td>integer</td> | 870 | <td>integer</td> |
869 | <td> | 871 | <td> |
870 | 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 /> |
871 | 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 the range. Use <a href="#priority"><tt>lanes.thread_priority_range()</tt></a> to query said range. |
872 | 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 /> |
873 | 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>. |
874 | </td> | 876 | </td> |
@@ -957,14 +959,17 @@ | |||
957 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"> | 959 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"> |
958 | <tr> | 960 | <tr> |
959 | <td> | 961 | <td> |
960 | <pre> lanes.set_thread_priority(prio)</pre> | 962 | <pre> prio_min, prio_max = lanes.thread_priority_range(prio [,"native"])</pre> |
963 | <pre> lanes.set_thread_priority(prio [,"native"])</pre> | ||
961 | </td> | 964 | </td> |
962 | </tr> | 965 | </tr> |
963 | </table> | 966 | </table> |
964 | <p> | 967 | <p> |
965 | 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. | 968 | 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. |
966 | <br /> | 969 | <br /> |
967 | The priority must be in the range <tt>[-3,+3]</tt>. | 970 | <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. |
971 | <br /> | ||
972 | <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. | ||
968 | </p> | 973 | </p> |
969 | 974 | ||
970 | 975 | ||