on master help sign in
Merge pull request #1467 from urbit/fix-threads-again

Fix threads again

commit376ceffea9ddfac74513c648d1bec2475896f882 authortinnus-napbus <77721746+tinnus-napbus@users.noreply.github.com> dateWed 4 May 2022, 22:10 (4 years ago) parent5485999e1098a8
7 files changed+10−10
content/docs/userspace/threads/examples/child-thread.md+3−3 content/docs/userspace/threads/gall/poke-thread.md+1−1 content/docs/userspace/threads/gall/start-thread.md+2−2 content/docs/userspace/threads/gall/stop-thread.md+1−1 content/docs/userspace/threads/gall/take-facts.md+1−1 content/docs/userspace/threads/gall/take-result.md+1−1 content/docs/userspace/threads/reference.md+1−1
content/docs/userspace/threads/examples/child-thread.md+3−3
@@ -75,7 +75,7 @@ We note that this is mostly the same as `await-thread:strandio`.
7575;< ~ bind:m %- poke-our
7676 :* %spider
7777 %spider-start
78− !>([`tid.bowl `tid byk.bowl(q da+now.bowl) %child !>(~)])
78+ !>([`tid.bowl `tid byk.bowl(r da+now.bowl) %child !>(~)])
7979 ==
8080;< =cage bind:m (take-fact /awaiting/[tid])
8181;< ~ bind:m (take-kick /awaiting/[tid])
@@ -131,7 +131,7 @@ We pre-emptively subscribe for the result. Spider sends the result at `/thread-r
131131;< ~ bind:m %- poke-our
132132 :* %spider
133133 %spider-start
134− !>([`tid.bowl `tid byk.bowl(q da+now.bowl) %child !>(~)])
134+ !>([`tid.bowl `tid byk.bowl(r da+now.bowl) %child !>(~)])
135135 ==
136136```
137137
@@ -184,7 +184,7 @@ Finally we test whether the thread produced a `%thread-done` or a `%thread-fail`
184184;< ~ bind:m %- poke-our
185185 :* %spider
186186 %spider-start
187− !>([`tid.bowl byk.bowl(q da+now.bowl) `tid %child !>(~)])
187+ !>([`tid.bowl byk.bowl(r da+now.bowl) `tid %child !>(~)])
188188 ==
189189;< ~ bind:m (sleep ~s5)
190190%- (slog leaf+"Stopping child thread..." ~)
content/docs/userspace/threads/gall/poke-thread.md+1−1
@@ -29,7 +29,7 @@ Here's a modified agent that pokes our thread. I've replaced some off the previo
2929 (pair term term)
3030 =/ tid `@ta`(cat 3 'thread_' (scot %uv (sham eny.bowl)))
3131 =/ ta-now `@ta`(scot %da now.bowl)
32− =/ start-args [~ `tid byk.bowl(q da+now.bowl) p.q.vase !>(q.q.vase)]
32+ =/ start-args [~ `tid byk.bowl(r da+now.bowl) p.q.vase !>(q.q.vase)]
3333 :_ this
3434 :~
3535 [%pass /thread/[ta-now] %agent [our.bowl %spider] %watch /thread-result/[tid]]
content/docs/userspace/threads/gall/start-thread.md+2−2
@@ -29,7 +29,7 @@ Here's an example of a barebones gall agent that just starts a thread:
2929 (pair term term)
3030 =/ tid `@ta`(cat 3 'thread_' (scot %uv (sham eny.bowl)))
3131 =/ ta-now `@ta`(scot %da now.bowl)
32− =/ start-args [~ `tid byk.bowl(q da+now.bowl) p.q.vase !>(q.q.vase)]
32+ =/ start-args [~ `tid byk.bowl(r da+now.bowl) p.q.vase !>(q.q.vase)]
3333 :_ this
3434 :~
3535 [%pass /thread/[ta-now] %agent [our.bowl %spider] %poke %spider-start !>(start-args)]
@@ -116,7 +116,7 @@ We can ignore the input logic, here's the important part:
116116```hoon
117117=/ tid `@ta`(cat 3 'thread_' (scot %uv (sham eny.bowl)))
118118=/ ta-now `@ta`(scot %da now.bowl)
119−=/ start-args [~ `tid byk.bowl(q da+now.bowl) p.q.vase !>(q.q.vase)]
119+=/ start-args [~ `tid byk.bowl(r da+now.bowl) p.q.vase !>(q.q.vase)]
120120:_ this
121121:~
122122 [%pass /thread/[ta-now] %agent [our.bowl %spider] %poke %spider-start !>(start-args)]
content/docs/userspace/threads/gall/stop-thread.md+1−1
@@ -29,7 +29,7 @@ Here we've added one last card to `on-poke` to stop the thread and a little extr
2929 (pair term term)
3030 =/ tid `@ta`(cat 3 'thread_' (scot %uv (sham eny.bowl)))
3131 =/ ta-now `@ta`(scot %da now.bowl)
32− =/ start-args [~ `tid byk.bowl(q da+now.bowl) p.q.vase !>(q.q.vase)]
32+ =/ start-args [~ `tid byk.bowl(r da+now.bowl) p.q.vase !>(q.q.vase)]
3333 :_ this
3434 :~
3535 [%pass /thread/[ta-now] %agent [our.bowl %spider] %watch /thread-result/[tid]]
content/docs/userspace/threads/gall/take-facts.md+1−1
@@ -31,7 +31,7 @@ Here we've added another card to subscribe for any facts sent by the thread and
3131 (pair term term)
3232 =/ tid `@ta`(cat 3 'thread_' (scot %uv (sham eny.bowl)))
3333 =/ ta-now `@ta`(scot %da now.bowl)
34− =/ start-args [~ `tid byk.bowl(q da+now.bowl) p.q.vase !>(q.q.vase)]
34+ =/ start-args [~ `tid byk.bowl(r da+now.bowl) p.q.vase !>(q.q.vase)]
3535 :_ this
3636 :~
3737 [%pass /thread/[ta-now] %agent [our.bowl %spider] %watch /thread-result/[tid]]
content/docs/userspace/threads/gall/take-result.md+1−1
@@ -29,7 +29,7 @@ Here we've added an extra card to subscribe for the result and a couple of lines
2929 (pair term term)
3030 =/ tid `@ta`(cat 3 'thread_' (scot %uv (sham eny.bowl)))
3131 =/ ta-now `@ta`(scot %da now.bowl)
32− =/ start-args [~ `tid byk.bowl(q da+now.bowl) p.q.vase !>(q.q.vase)]
32+ =/ start-args [~ `tid byk.bowl(r da+now.bowl) p.q.vase !>(q.q.vase)]
3333 :_ this
3434 :~
3535 [%pass /thread/[ta-now] %agent [our.bowl %spider] %watch /thread-result/[tid]]
content/docs/userspace/threads/reference.md+1−1
@@ -25,7 +25,7 @@ Where:
2525 [%ud p=@ud] :: number
2626 ==
2727 ```
28− You'll almost always just want the current revision, so you can specify the `case` as `da+now.bowl`. If the thread is on the same desk as the agent, you can also just use `byk.bowl` for the `beak`.
28+ You'll almost always just want the current revision, so you can specify the `case` as `da+now.bowl`. If the thread is on the same desk as the agent you can also just use `byk.bowl(r da+now)` for the `beak`.
2929- `file` - name of the thread file in `/ted`. For example, if the thread you want to start is `/ted/foo/hoon` you'd specify `%foo`.
3030- `vase` - `vase` to be given to the thread when it's started. Can be whatever or just `!>(~)` if it doesn't need any args.
3131