Trait/Object

fs2.async.mutable

Semaphore

Related Docs: object Semaphore | package mutable

Permalink

trait Semaphore[F[_]] extends AnyRef

An asynchronous semaphore, useful as a concurrency primitive.

Source
Semaphore.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Semaphore
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def available: F[Long]

    Permalink

    Returns the number of permits currently available.

    Returns the number of permits currently available. Always nonnegative.

  2. abstract def clear: F[Long]

    Permalink

    Reset the count of this semaphore back to zero, and return the previous count.

    Reset the count of this semaphore back to zero, and return the previous count. Throws an IllegalArgumentException if count is below zero (due to pending decrements).

  3. abstract def count: F[Long]

    Permalink

    Obtain a snapshot of the current count.

    Obtain a snapshot of the current count. May be out of date the instant after it is retrieved. Use tryDecrement or tryDecrementBy if you wish to attempt a decrement and return immediately if the current count is not high enough to satisfy the request.

  4. abstract def decrementBy(n: Long): F[Unit]

    Permalink

    Decrement the number of available permits by n, blocking until n are available.

    Decrement the number of available permits by n, blocking until n are available. Error if n < 0. The blocking is semantic; we do not literally block a thread waiting for permits to become available. Note that decrements are satisfied in strict FIFO order, so given s: Semaphore[F] with 2 permits available, a decrementBy(3) will always be satisfied before a later call to decrementBy(1).

  5. abstract def incrementBy(n: Long): F[Unit]

    Permalink

    Increment the number of available permits by n.

    Increment the number of available permits by n. Error if n < 0. This will have the effect of unblocking n acquisitions.

  6. abstract def tryDecrementBy(n: Long): F[Boolean]

    Permalink

    Acquire n permits now and return true, or return false immediately.

    Acquire n permits now and return true, or return false immediately. Error if n < 0.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Semaphore[F] to any2stringadd[Semaphore[F]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Semaphore[F], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Semaphore[F] to ArrowAssoc[Semaphore[F]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def decrement: F[Unit]

    Permalink

    Decrement the number of permits by 1.

    Decrement the number of permits by 1. Just calls decrementBy(1).

  9. def ensuring(cond: (Semaphore[F]) ⇒ Boolean, msg: ⇒ Any): Semaphore[F]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Semaphore[F] to Ensuring[Semaphore[F]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: (Semaphore[F]) ⇒ Boolean): Semaphore[F]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Semaphore[F] to Ensuring[Semaphore[F]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean, msg: ⇒ Any): Semaphore[F]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Semaphore[F] to Ensuring[Semaphore[F]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean): Semaphore[F]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Semaphore[F] to Ensuring[Semaphore[F]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Semaphore[F] to StringFormat[Semaphore[F]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  17. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  18. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  19. final def increment: F[Unit]

    Permalink

    Increment the number of permits by 1.

    Increment the number of permits by 1. Just calls incrementBy(1).

  20. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  21. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  25. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  26. def tryDecrement: F[Boolean]

    Permalink

    Just calls tryDecrementBy(1).

  27. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. def [B](y: B): (Semaphore[F], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Semaphore[F] to ArrowAssoc[Semaphore[F]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Semaphore[F] to any2stringadd[Semaphore[F]]

Inherited by implicit conversion StringFormat from Semaphore[F] to StringFormat[Semaphore[F]]

Inherited by implicit conversion Ensuring from Semaphore[F] to Ensuring[Semaphore[F]]

Inherited by implicit conversion ArrowAssoc from Semaphore[F] to ArrowAssoc[Semaphore[F]]

Ungrouped