repos / starfx

supercharged async flow control library.
git clone https://github.com/neurosnap/starfx.git

commit
a1278f6
parent
281d65e
author
Eric Bower
date
2023-11-24 16:15:35 +0000 UTC
docs: readme
1 files changed,  +26, -0
M README.md
+26, -0
 1@@ -155,6 +155,32 @@ function App() {
 2 
 3 Please see [examples repo](https://github.com/neurosnap/starfx-examples).
 4 
 5+# what is structured concurrency?
 6+
 7+This is a board term so I'll make this specific to how `starfx` works.
 8+
 9+Under-the-hood, thunks and endpoints are registered under the root task. Every
10+thunk and endpoint has their own supervisor that manages them. As a result, what
11+we have is a single root task for your entire app that is being managed by
12+supervisor tasks. When the root task receives a signal to shutdown itself (e.g.
13+`task.halt()` or closing browser tab) it first must shutdown all children tasks
14+before being resolved.
15+
16+When a child task throws an exception (whether intentional or otherwise) it will
17+propagate that error up the task tree until it is caught or reaches the root
18+task.
19+
20+In review:
21+
22+- There is a single root task for an app
23+- The root task can spawn child tasks
24+- If root task is halted then all child tasks are halted first
25+- If a child task is halted or raises exception, it propagates error up the task
26+  tree
27+- An exception can be caught at any point in the task tree
28+- Supervisor tasks are designed to monitor task health (and automatically
29+  recover in many cases)
30+
31 # talk
32 
33 I recently gave a talk about deliminited continuations where I also discuss this