diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/index.html | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/docs/index.html b/docs/index.html index 8e84fcb..148b5ab 100644 --- a/docs/index.html +++ b/docs/index.html | |||
@@ -1222,15 +1222,16 @@ | |||
1222 | </p> | 1222 | </p> |
1223 | 1223 | ||
1224 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> | 1224 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> |
1225 | bool|(nil,[lanes.cancel_error|"timeout"]) = h:limit(key, <limit>) | 1225 | bool,string|(nil,[lanes.cancel_error|"timeout"]) = h:limit(key, <limit>) |
1226 | >limit< = h:limit(key) | 1226 | (number|string),string = h:limit(key) |
1227 | </pre></td></tr></table> | 1227 | </pre></td></tr></table> |
1228 | 1228 | ||
1229 | <p> | 1229 | <p> |
1230 | By default, queue sizes are unlimited but limits can be enforced using the <tt>limit()</tt> method. This can be useful to balance execution speeds in a producer/consumer scenario.<br /> | 1230 | By default, queue sizes are unlimited but limits can be enforced using the <tt>limit()</tt> method. This can be useful to balance execution speeds in a producer/consumer scenario.<br /> |
1231 | A limit of 0 is allowed to block everything. <tt>"unlimited"</tt> removes the limit.<br /> | 1231 | A limit of 0 is allowed to block everything. <tt>"unlimited"</tt> removes the limit.<br /> |
1232 | If the key was full but the limit change added some room, <tt>limit()</tt> returns <tt>true</tt> and the Linda is signalled so that <tt>send()</tt>-blocked threads are awakened, else the return value is <tt>false</tt>. | 1232 | If the key was full but the limit change added some room, <tt>limit()</tt> first return value is <tt>true</tt> and the Linda is signalled so that <tt>send()</tt>-blocked threads are awakened, else the return value is <tt>false</tt>. |
1233 | If no limit is provided, <tt>limit()</tt> returns a single value, the current limit for the specified key.<br /> | 1233 | If no limit is provided, <tt>limit()</tt> first return value is the current limit for the specified key.<br /> |
1234 | The second returned value is a string representing the fill status relatively to the key's current limit (one of <tt>"over"</tt>, <tt>"under"</tt>, <tt>"exact"</tt>). | ||
1234 | Whether reading or writing, if the Linda is cancelled, <tt>limit()</tt> returns <tt>nil, lanes.cancel_error</tt>. | 1235 | Whether reading or writing, if the Linda is cancelled, <tt>limit()</tt> returns <tt>nil, lanes.cancel_error</tt>. |
1235 | </p> | 1236 | </p> |
1236 | 1237 | ||
@@ -1292,30 +1293,30 @@ | |||
1292 | </p> | 1293 | </p> |
1293 | 1294 | ||
1294 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> | 1295 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"><tr><td><pre> |
1295 | true|nil,lanes.cancel_error = linda_h:set(key [, val [, ...]]) | 1296 | (bool,string)|(nil,lanes.cancel_error) = linda_h:set(key [, val [, ...]]) |
1296 | 1297 | ||
1297 | [number,[val [, ...]]|nil,lanes.cancel_error] = linda_h:get(key [, count = 1]) | 1298 | (number,[val [, ...]])|(nil,lanes.cancel_error) = linda_h:get(key [, count = 1]) |
1298 | </pre></td></tr></table> | 1299 | </pre></td></tr></table> |
1299 | 1300 | ||
1300 | <p> | 1301 | <p> |
1301 | The table access methods are for accessing a slot without queuing or consuming. They can be used for making shared tables of storage among the lanes.<br /> | 1302 | <tt>get()</tt>/<tt>set()</tt> and <tt>send()</tt>/<tt>receive()</tt> can be used together; reading a slot essentially peeks the next outcoming value of a queue.<br /> |
1302 | Writing to a slot never blocks because it ignores the limit. It overwrites existing value and clears any possible queued entries.<br /> | 1303 | <tt>get()</tt>/<tt>set()</tt> are for accessing a key without queuing or consuming. They can be used for making shared tables of storage among the lanes.<br /> |
1303 | Reading doesn't block either because <tt>get()</tt> returns: | 1304 | Writing to a key never blocks because it ignores the limit. It overwrites existing values and clears any possible queued entries.<br /> |
1305 | </p> | ||
1306 | <p> | ||
1307 | <tt>get()</tt> can read several values at once, and does not block. Return values ares: | ||
1304 | <ul> | 1308 | <ul> |
1305 | <li><tt>nil, lanes.cancel_error</tt> in case of cancellation.</li> | 1309 | <li><tt>nil, lanes.cancel_error</tt> in case of cancellation.</li> |
1306 | <li><tt>number, val...</tt> where number is the actual count of items obtained from the linda (can be 0).</li> | 1310 | <li><tt>number, val...</tt> where number is the actual count of items obtained from the linda (can be 0).</li> |
1307 | </ul> | 1311 | </ul> |
1308 | Table access and <tt>send()</tt>/<tt>receive()</tt> can be used together; reading a slot essentially peeks the next outcoming value of a queue. | ||
1309 | </p> | ||
1310 | |||
1311 | <p> | ||
1312 | <tt>set()</tt> signals the Linda for write if a value is stored. If nothing special happens, <tt>set() </tt>returns nothing.<br /> | ||
1313 | If the key was full but the new data count of the key after <tt>set()</tt> is below its limit, <tt>set()</tt> returns <tt>true</tt> and the Linda is also signaled for read so that <tt>send()</tt>-blocked threads are awakened. | ||
1314 | </p> | 1312 | </p> |
1315 | |||
1316 | <p> | 1313 | <p> |
1317 | <tt>set()</tt> can write several values at the specified key, writing <tt>nil</tt> values is now possible, and clearing the contents at the specified key is done by not providing any value.<br /> | 1314 | <tt>set()</tt> can write several values at the specified key. Writing <tt>nil</tt> values is possible, and clearing the contents at the specified key is done by not providing any value.<br /> |
1318 | Also, <tt>get()</tt> can read several values at once. If the key contains no data, <tt>get()</tt> returns no value. This can be used to separate the case when reading stored <tt>nil</tt> values. | 1315 | If <tt>set()</tt> actually stores data, the Linda is signalled for write, so that <tt>receive()</tt>-blocked Lanes are awakened.<br /> |
1316 | Clearing the contents of a non-existent key does not create it!<br /> | ||
1317 | If the key was full but the new data count of the key after <tt>set()</tt> is below its limit, <tt>set()</tt> first return value is <tt>true</tt> and the Linda is also signaled for read, so that <tt>send()</tt>-blocked Lanes are awakened.<br /> | ||
1318 | If the key was not already full, nothing additional happens, and <tt>set()</tt> first return value is <tt>false</tt>.<br /> | ||
1319 | The second return value is a string representing the fill status relatively to the key's current limit (one of <tt>"over"</tt>, <tt>"under"</tt>, <tt>"exact"</tt>). | ||
1319 | </p> | 1320 | </p> |
1320 | 1321 | ||
1321 | <p> | 1322 | <p> |