Poke Thread
Here's a modified agent that pokes a thread. We start it by poking Spider directly because we need to know the thread ID to poke the thread itself. In this example we use a thread file, but an inline thread could also be used.
And here's a thread to take the poke and return it as the result:
/- spider
/+ *strandio
|= arg=vase
=/ m (strand:rand ,vase)
^- form:m
;< vmsg=vase bind:m (take-poke %foo)
(pure:m vmsg)Save them, |commit %base, |start %thread-starter, and run :thread-starter [%test-thread %blah]. You should see:
Result: blah
> :thread-starter [%test-thread %blah]Analysis
In our agent we've added this card:
[%pass /thread/[ta-now] %agent [our.bowl %spider] %poke %spider-input !>([tid %foo !>(q.q.vase)])]To poke a particular thread you poke %spider with a mark of %spider-input and a vase of [tid cage] where:
$tidis the thread you want to poke$cagehas whatever mark and vase of data you want to give the thread
In our case we've given it a mark of %foo and a vase of whatever $term we poked our agent with.
In our thread we've added:
;< vmsg=vase bind:m (take-poke %foo)+take-poke is a strandio function that just waits for a poke with the given mark and skips everything else. In this case we've specified a mark of %foo. Once our thread gets a poke with this mark it returns it as a result with (pure:m vmsg). When our agent gets that it just prints it.
Last updated