acquirethat latch, which blocks the thread until it gets released
unsafeRunSyncis "create shared state, create waiting condition, run asynchronously (sets state and releases waiting condition), wait on condition, return shared state"
toIOon ConcurrentEffect, it's the same mechanism but "one level up"
asyncdirectly now. It used to be
case Duration.Inf => blocking(latch.acquireSharedInterruptibly(1)) case f: FiniteDuration if f > Duration.Zero => blocking(latch.tryAcquireSharedNanos(1, f.toNanos))
unsafeRunTimed(Duration.Inf)and there are some other details
global), will react to the hint by creating a new thread, since they know that it's going to be blocked
blockingis mostly about trying to make sure blocking code stays out of the way of non-blocking one, under the assumption that they share the same thread pool. Cats-effect tries to avoid them sharing the same thread pool to begin with (hence Blocker vs ContextShift)
implicit ec: ExecutionContext
globalis a good default choice for that philosophy
Blockerprovides the blocking pool
ContextShift[IO], does it shift from dispatch to work pool?