From dddc28153796f9c8eb256eddb335c8643226fd0b Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Wed, 12 Jun 2024 18:18:24 +0200 Subject: linda :get(), :set(), :limit() return value changes --- docs/index.html | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/index.html b/docs/index.html index e884145..06ce610 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1209,13 +1209,14 @@

-	true|(nil,[lanes.cancel_error|"timeout"]) = h:limit(key, n_uint)
+	bool|(nil,[lanes.cancel_error|"timeout"]) = h:limit(key, n_uint)
 

By default, queue sizes are unlimited but limits can be enforced using the limit() method. This can be useful to balance execution speeds in a producer/consumer scenario. nil removes the limit.
A limit of 0 is allowed to block everything.
- If the key was full but the limit change added some room, limit() returns true and the Linda is signalled so that send()-blocked threads are awakened.
+ If the key was full but the limit change added some room, limit() returns true and the Linda is signalled so that send()-blocked threads are awakened, else the return value is false.
+ Or nil, lanes.cancel_error in case of cancellation, of course.

@@ -1276,15 +1277,19 @@
 

-	true|lanes.cancel_error = linda_h:set(key [, val [, ...]])
+	true|nil,lanes.cancel_error = linda_h:set(key [, val [, ...]])
 
-	[[val [, ...]]|lanes.cancel_error] = linda_h:get(key [, count = 1])
+	[number,[val [, ...]]|nil,lanes.cancel_error] = linda_h:get(key [, count = 1])
 

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.
Writing to a slot never blocks because it ignores the limit. It overwrites existing value and clears any possible queued entries.
- Reading doesn't block either because get() returns whatever is available (which can be nothing), up to the specified count.
+ Reading doesn't block either because get() returns: +

    +
  • nil, lanes.cancel_error in case of cancellation.
  • +
  • number, val... where number is the actual count of items obtained from the linda (can be 0).
  • +
Table access and send()/receive() can be used together; reading a slot essentially peeks the next outcoming value of a queue.

-- cgit v1.2.3-55-g6feb