core-async

Benjamin 2022-11-02T10:02:59.775849Z

Hello,

(a/go (slurp ""))
let's say I slurp a big file - will this consume my go threads? How do I write it in a way that will park the go thread?

Ben Sless 2022-11-02T10:18:39.483589Z

Wrap it in a thread and parking take from it

Benjamin 2022-11-02T10:44:01.635659Z

(a/go (a/<! (a/thread (slurp ""))))
this you mean?

Ben Sless 2022-11-02T10:52:14.861349Z

Exactly

✍️ 1
dpsutton 2022-11-02T11:56:16.633119Z

Don’t think you need the go and the <! Since a/thread returns a channel with the value already

Benjamin 2022-11-02T12:09:20.444399Z

I suppose the assumption was that there is more code inside the go block. I am now indeed just doing a/thread . Guessing there is virtually no difference between that and future .. ?

Ben Sless 2022-11-02T12:09:53.012409Z

Future returns a deref-able thing, thread returns channel

👍 1