scala

# concurrent

#### package concurrent

This package object contains primitives for concurrent and parallel programming.

Linear Supertypes
AnyRef, Any
Content Hierarchy Learn more about scaladoc diagrams
Ordering

1. Alphabetic
2. By inheritance

Inherited

1. concurrent
2. AnyRef
3. Any

1. Hide All
2. Show all

Learn more about member selection
Visibility

1. Public
2. All

### Type Members

1. #### trait Awaitable[+T] extends AnyRef

   An object that may eventually be completed with a result value of type `T` which may be awaited using blocking methods.

2. #### trait BlockContext extends AnyRef

   A context to be notified by `scala.concurrent.blocking` when a thread is about to block.

3. #### sealed trait CanAwait extends AnyRef

   Annotations
     @implicitNotFound( msg = ... )

4. #### type CancellationException = java.util.concurrent.CancellationException

5. #### class Channel[A] extends AnyRef

   This class .

6. #### class DelayedLazyVal[T] extends AnyRef

   A `DelayedLazyVal` is a wrapper for lengthy computations which have a valid partially computed result.

7. #### trait ExecutionContext extends AnyRef

   An `ExecutionContext` can execute program logic asynchronously, typically but not necessarily on a thread pool.

8. #### trait ExecutionContextExecutor extends ExecutionContext with Executor

   Union interface since Java does not support union types

9. #### trait ExecutionContextExecutorService extends ExecutionContextExecutor with ExecutorService

   Union interface since Java does not support union types

10. #### type ExecutionException = java.util.concurrent.ExecutionException

11. #### trait Future[+T] extends Awaitable[T]

    The trait that represents futures.

12. #### class Lock extends AnyRef

    This class .

13. #### trait OnCompleteRunnable extends AnyRef

    A marker indicating that a `java.lang.Runnable` provided to `scala.concurrent.ExecutionContext` wraps a callback provided to `Future.onComplete`.

14. #### trait Promise[T] extends AnyRef

    Promise is an object which can be completed with a value or failed with an exception.

15. #### class SyncChannel[A] extends AnyRef

    A `SyncChannel` allows one to exchange data synchronously between a reader and a writer thread.

16. #### class SyncVar[A] extends AnyRef

    A class to provide safe concurrent access to a mutable cell.

17. #### type TimeoutException = java.util.concurrent.TimeoutException

### Value Members

1. #### object Await

   `Await` is what is used to ensure proper handling of blocking for `Awaitable` instances.

2. #### object BlockContext

3. #### object ExecutionContext

   Contains factory methods for creating execution contexts.

4. #### object Future

   Future companion object.

5. #### object JavaConversions

   The `JavaConversions` object provides implicit converstions supporting interoperability between Scala and Java concurrency classes.

6. #### object Promise

7. #### def blocking[T](body: ⇒ T): T

   Used to designate a piece of code which potentially blocks, allowing the current BlockContext to adjust the runtime's behavior.

   Used to designate a piece of code which potentially blocks, allowing the current BlockContext to adjust the runtime's behavior. Properly marking blocking code may improve performance or avoid deadlocks.

   Blocking on an Awaitable should be done using Await.result instead of `blocking`.

   body

     A piece of code which contains potentially blocking or long running calls.

   Annotations
     @throws( clazz = classOf[Exception] )
   Exceptions thrown
     `CancellationException`

     if the computation was cancelled

     `InterruptedException`

     in the case that a wait within the blocking `body` was interrupted

8. #### package duration

### Deprecated Value Members

1. #### def future[T](body: ⇒ T)(implicit executor: ExecutionContext): Future[T]

   Starts an asynchronous computation and returns a `Future` object with the result of that computation.

   Starts an asynchronous computation and returns a `Future` object with the result of that computation.

   The result becomes available once the asynchronous computation is completed.

   T

     the type of the result

   body

     the asynchronous computation

   executor

     the execution context on which the future is run

   returns

     the `Future` holding the result of the computation

   Annotations
     @deprecated
   Deprecated

     (Since version 2.11.0) Use `Future { ... }` instead.

2. #### def promise[T](): Promise[T]

   Creates a promise object which can be completed with a value or an exception.

   Creates a promise object which can be completed with a value or an exception.

   T

     the type of the value in the promise

   returns

     the newly created `Promise` object

   Annotations
     @deprecated
   Deprecated

     (Since version 2.11.0) Use `Promise[T]()` instead.

### Inherited from AnyRef

### Inherited from Any

### Ungrouped