about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-03-14 09:56:07 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-03-14 09:56:41 -0700
commita8df25c49709421b2033b72371f9387c0c4c13a3 (patch)
treebfb7d141327fb606aae12a0fc7248c7356f0f5a9
parentb571a342d7131b747db27faabd8f9193cbea6f12 (diff)
downloadteliva-a8df25c49709421b2033b72371f9387c0c4c13a3.tar.gz
doc: flesh out tasks and channels
-rw-r--r--doc/manual.html52
1 files changed, 51 insertions, 1 deletions
diff --git a/doc/manual.html b/doc/manual.html
index a0f485c..1f317af 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -4180,7 +4180,57 @@ Returns a value representing the JSON string read from channel
 Teliva includes the well-known
 <a href='https://github.com/majek/lua-channels#readme'>lua-channels</a>
 library in module <code>task</code>. It also transparently starts up
-<code>task.scheduler</code> for all apps.
+<code>task.scheduler</code> for all apps. See sieve.tlv for a basic example.
+
+<p>
+<hr><h3><a name="pdf-task.spawn"><code>task.spawn (fun, [...])</code></a></h3>
+
+
+<p>
+Run <code>fun</code> as a coroutine with given parameters. You should use this
+instead of <code>coroutine.create()</code>.
+
+
+<p>
+<hr><h3><a name="pdf-task.scheduler"><code>task.scheduler ()</code></a></h3>
+
+
+<p>
+Starts running any spawned tasks. You shouldn't need to ever call this from
+Teliva. The scheduler is always started for you.
+
+
+<p>
+<hr><h3><a name="pdf-Channel:new"><code>task.Channel:new ([size])</code></a></h3>
+
+
+<p>
+Create a new channel with given size (which defaults to 0).
+
+
+<p>
+<hr><h3><a name="pdf-channel:send"><code>channel:send (value)</code></a></h3>
+
+
+<p>
+Write <code>value</code> to a channel. Blocks the current coroutine if the
+channel is already full. (Channels with size 0 always block if there isn't
+already a coroutine trying to <code>recv()</code> from them.)
+
+
+<p>
+<hr><h3><a name="pdf-channel:recv"><code>channel:recv ()</code></a></h3>
+
+
+<p>
+Read a value from a channel. Blocks the current coroutine if the
+channel is empty and there isn't already a coroutine trying to
+<code>send()</code> to them.
+
+
+<p>
+Besides these, there are other primitives that have never been used in Teliva
+apps, but should still work. Please report if you try them out.
 
 </div>