CountDownLatch

cats.effect.std.CountDownLatch
See theCountDownLatch companion object
abstract class CountDownLatch[F[_]]

Concurrency abstraction that supports fiber blocking until n latches are released. Note that this has 'one-shot' semantics - once the counter reaches 0 then release and await will forever be no-ops

See https://typelevel.org/blog/2020/10/30/concurrency-in-ce3.html for a walkthrough of building something like this

Attributes

Companion
object
Source
CountDownLatch.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Abstract methods

def await: F[Unit]

Semantically block until the count reaches 0

Semantically block until the count reaches 0

Attributes

Source
CountDownLatch.scala
def release: F[Unit]

Release a latch, decrementing the remaining count and releasing any fibers that are blocked if the count reaches 0

Release a latch, decrementing the remaining count and releasing any fibers that are blocked if the count reaches 0

Attributes

Source
CountDownLatch.scala

Concrete methods

def mapK[G[_]](f: FunctionK[F, G]): CountDownLatch[G]

Attributes

Source
CountDownLatch.scala