Fork me on GitHub
#core-async
<
2017-03-30
>
troglotit00:03:02

Hello! I'm trying to wrap my head around pipeline and pipeline-blocking. How exactly we are going to execute parallelism if operations are blocking? Or what does it mean that it's (pipeline-blocking) for blocking operations?

noisesmith01:03:00

it's for cases where the parallelized code might block its own thread

noisesmith01:03:23

eg. it does IO without an async IO wrapper

noisesmith01:03:10

your original thread (the one that calls pipeline-blocking) is not blocked, but the difference is which kind of context the parallel code should run in

noisesmith01:03:39

so pipeline or pipeline-async are safe for code that is async (and you want it to run in multiple async blocks), and pipeline-blocking is for code that would hog the thread, so it needs a (more expensive) thread from a different pool

noisesmith01:03:01

since core.async only uses 8 threads in its pool by default, you need to be careful not to starve it by blocking its threads

noisesmith01:03:09

hope that's clear

troglotit01:03:23

>eg. it does IO without an async IO wrapper

troglotit01:03:33

this one is clear 😅 Thank you!

royalaid20:03:07

@troglotit It took me a while to understand as well but make sure you use pipeline-blocking for an deref/`@ `. It seems obvious but I often tripped over my code deadlocking so "no reason" even though I was at fault.