(call this value)
Returns a promise with the result from the worker. May block. The value of the promise will be nil if the worker has already stopped.
Returns a promise with the result from the worker. May block. The value of the promise will be nil if the worker has already stopped.
(dispatch this value)
Sends a message to the worker. May block. Returns true if the value could be delivered to the worker's input channel.
Sends a message to the worker. May block. Returns true if the value could be delivered to the worker's input channel.
(start name-str initial-data callback)
(start name-str initial-data callback outbox)
Start a worker and return associated core.async channels. Work is received
on an 'input' channel (:in
) and results are sent to an 'output' channel
(:out
). See the dispatch
and call
functions for convenient ways of
interacting with the worker.
The caller can provide the output channel by specifying outbox
. If no
output channel in needed, pass nil
for the outbox, otherwise the worker
will block expecting an output consumer.
The work is performed by the callback function. That function will be
provided two arguments: the current version of data
and the value that was
sent to the input channel. The callback function must return one of three values:
nil
no change in data and no output
[new-data]new value for
data, but no output
[new-data output-value] new value for
data, and output is produced
The initial value of data
should be passed as the initial-data
parameter.
Start a worker and return associated core.async channels. Work is received on an 'input' channel (`:in`) and results are sent to an 'output' channel (`:out`). See the `dispatch` and `call` functions for convenient ways of interacting with the worker. The caller can provide the output channel by specifying `outbox`. If no output channel in needed, pass `nil` for the outbox, otherwise the worker will block expecting an output consumer. The work is performed by the callback function. That function will be provided two arguments: the current version of `data` and the value that was sent to the input channel. The callback function must return one of three values: `nil` no change in `data and no output `[new-data]` new value for `data, but no output `[new-data output-value] new value for `data, and output is produced The initial value of `data` should be passed as the `initial-data` parameter.
(stop! this)
Stops the worker thread and closes the associated channels.
Stops the worker thread and closes the associated channels.
(unwrap msg)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close