Class/Object

fs2.async.mutable

Semaphore

Related Docs: object Semaphore | package mutable

Permalink

abstract class 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

Instance Constructors

  1. new Semaphore()

    Permalink

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

    Resets the count of this semaphore back to zero, and returns the previous count.

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

  3. abstract def count: F[Long]

    Permalink

    Obtains a snapshot of the current count.

    Obtains 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

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

    Decrements 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

    Increments the number of available permits by n.

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

  6. abstract def timedDecrement(timeout: FiniteDuration, scheduler: Scheduler): F[Boolean]

    Permalink

    Like decrement but limits the amount of time spent blocking for a permit.

    Like decrement but limits the amount of time spent blocking for a permit. If the permit has not been acquired after the timeout has been reached, the action completes with false. If a permit is acquired, the action completes with true.

  7. abstract def timedDecrementBy(n: Long, timeout: FiniteDuration, scheduler: Scheduler): F[Long]

    Permalink

    Like decrementBy but limits the amount of time spent blocking for permits.

    Like decrementBy but limits the amount of time spent blocking for permits. If all permits have not been acquired after the timeout has been reached, the action completes with the number of permits remaining to be acquired. If the requested number of permits is acquired, the action completes with 0.

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

    Permalink

    Acquires n permits now and returns true, or returns false immediately.

    Acquires n permits now and returns true, or returns 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

    Decrements the number of permits by 1.

    Decrements the number of permits by 1. Alias for 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

    Increments the number of permits by 1.

    Increments the number of permits by 1. Alias for 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

    Alias for 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