Packages

  • package root
    Definition Classes
    root
  • package fs2
    Definition Classes
    root
  • package async

    Provides utilities for asynchronous computations.

    Provides utilities for asynchronous computations.

    Definition Classes
    fs2
  • package mutable

    Provides types which allow asynchronous reading and writing.

    Provides types which allow asynchronous reading and writing.

    Definition Classes
    async
  • Queue
  • Semaphore
  • Signal
  • Topic

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()

Abstract Value Members

  1. abstract def available: F[Long]

    Returns the number of permits currently available.

    Returns the number of permits currently available. Always nonnegative.

  2. abstract def clear: F[Long]

    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]

    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]

    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]

    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]

    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]

    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]

    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
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    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)
    Implicit
    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
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  8. final def decrement: F[Unit]

    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]
    Implicit
    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]
    Implicit
    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]
    Implicit
    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]
    Implicit
    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
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def formatted(fmtstr: String): String
    Implicit
    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[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  19. final def increment: F[Unit]

    Increments the number of permits by 1.

    Increments the number of permits by 1. Alias for incrementBy(1).

  20. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  21. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. def tryDecrement: F[Boolean]

    Alias for tryDecrementBy(1).

  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  30. def [B](y: B): (Semaphore[F], B)
    Implicit
    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