Package

scalaz

concurrent

Permalink

package concurrent

Visibility
  1. Public
  2. All

Type Members

  1. final case class Actor[A](handler: (A) ⇒ Unit, onError: (Throwable) ⇒ Unit = ActorUtils.rethrowError)(implicit strategy: Strategy) extends Product with Serializable

    Permalink

    Processes messages of type A, one at a time.

    Processes messages of type A, one at a time. Messages are submitted to the actor with the method !. Processing is typically performed asynchronously, this is controlled by the provided strategy.

    Memory consistency guarantee: when each message is processed by the handler, any memory that it mutates is guaranteed to be visible by the handler when it processes the next message, even if the strategy runs the invocations of handler on separate threads. This is achieved because the Actor reads a volatile memory location before entering its event loop, and writes to the same location before suspending.

    Implementation based on non-intrusive MPSC node-based queue, described by Dmitriy Vyukov: http://www.1024cores.net/home/lock-free-algorithms/queues/non-intrusive-mpsc-node-based-queue

    A

    The type of messages accepted by this actor.

    handler

    The message handler

    onError

    Exception handler, called if the message handler throws any Throwable.

    strategy

    Execution strategy, for example, a strategy that is backed by an ExecutorService

  2. trait ActorFunctions extends AnyRef

    Permalink
  3. sealed abstract class ActorInstances extends AnyRef

    Permalink
  4. trait Atomic[A] extends AnyRef

    Permalink
  5. trait Atomics extends AnyRef

    Permalink
  6. trait BooleanLatch extends AnyRef

    Permalink
  7. sealed abstract class Chan[A] extends AnyRef

    Permalink
  8. trait Concurrents extends ActorFunctions

    Permalink
  9. sealed abstract class Future[+A] extends AnyRef

    Permalink

    Future is a trampolined computation producing an A that may include asynchronous steps.

    Future is a trampolined computation producing an A that may include asynchronous steps. Like Trampoline, arbitrary monadic expressions involving map and flatMap are guaranteed to use constant stack space. But in addition, one may construct a Future from an asynchronous computation, represented as a function, listen: (A => Unit) => Unit, which registers a callback that will be invoked when the result becomes available. This makes Future useful as a concurrency primitive and as a control structure for wrapping callback-based APIs with a more straightforward, monadic API.

    Unlike the Future implementation in scala 2.10, map and flatMap do NOT spawn new tasks and do not require an implicit ExecutionContext. Instead, map and flatMap merely add to the current (trampolined) continuation that will be run by the 'current' thread, unless explicitly forked via Future.fork or Future.apply. This means that Future achieves much better thread reuse than the 2.10 implementation and avoids needless thread pool submit cycles.

    Future also differs from the scala 2.10 Future type in that it does not necessarily represent a _running_ computation. Instead, we reintroduce nondeterminism _explicitly_ using the functions of the scalaz.Nondeterminism interface. This simplifies our implementation and makes code easier to reason about, since the order of effects and the points of nondeterminism are made fully explicit and do not depend on Scala's evaluation order.

    IMPORTANT NOTE: Future does not include any error handling and should generally only be used as a building block by library writers who want to build on Future's capabilities but wish to design their own error handling strategy. See scalaz.concurrent.Task for a type that extends Future with proper error handling -- it is merely a wrapper for Future[Throwable \/ A] with a number of additional convenience functions.

  10. sealed abstract class MVar[A] extends AnyRef

    Permalink
  11. trait MVarFunctions extends AnyRef

    Permalink
  12. sealed abstract class PhasedLatch extends AnyRef

    Permalink
  13. trait PhasedLatches extends AnyRef

    Permalink
  14. trait Run[F] extends AnyRef

    Permalink
  15. trait Strategy extends AnyRef

    Permalink

    Evaluate an expression in some specific manner.

    Evaluate an expression in some specific manner. A typical strategy will schedule asynchronous evaluation and return a function that, when called, will block until the result is ready.

    Memory consistency effects: Actions in a thread prior to the submission of a to the Strategy happen-before any actions taken by a, which in turn happen-before the result is retrieved via returned function.

  16. trait Strategys extends StrategysLow

    Permalink
  17. trait StrategysLow extends AnyRef

    Permalink
  18. class Task[+A] extends AnyRef

    Permalink

    Task[A] wraps a scalaz.concurrent.Future[Throwable \/ A], with some convenience functions for handling exceptions.

    Task[A] wraps a scalaz.concurrent.Future[Throwable \/ A], with some convenience functions for handling exceptions. Its Monad and Nondeterminism instances are derived from Future.

    Task (and Future) differ in several key ways from the Future implementation in Scala 2.10 , and have a number of advantages. See the documentation for scalaz.concurrent.Future for more information.

    Task is exception-safe when constructed using the primitives in the companion object, but when calling the constructor, you are responsible for ensuring the exception safety of the provided Future.

  19. trait TaskApp extends AnyRef

    Permalink

    Safe App trait that runs a scalaz.concurrent.Task action.

    Safe App trait that runs a scalaz.concurrent.Task action.

    Clients should implement run, runl, or runc.

  20. trait Timeout extends AnyRef

    Permalink
  21. case class Timer(timeoutTickMs: Int = 100, workerName: String = "TimeoutContextWorker") extends Product with Serializable

    Permalink

Value Members

  1. object Actor extends ActorInstances with ActorFunctions with Serializable

    Permalink
  2. object Atomic extends Atomics

    Permalink
  3. object BooleanLatch

    Permalink
  4. object Chan

    Permalink
  5. object Concurrent extends Concurrents

    Permalink
  6. object Future

    Permalink
  7. object MVar extends MVarFunctions

    Permalink
  8. object PhasedLatch extends PhasedLatches

    Permalink
  9. object Run

    Permalink
  10. object Strategy extends Strategys

    Permalink
  11. object Task

    Permalink
  12. object Timeout extends Timeout

    Permalink
  13. object Timer extends Serializable

    Permalink

Ungrouped