Movatterモバイル変換


[0]ホーム

URL:


Scala 3
3.7.4
LearnInstallPlaygroundFind A LibraryCommunityBlog
Scala 3
LearnInstallPlaygroundFind A LibraryCommunityBlog
DocsAPI
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL
Scala 3/scala/scala.concurrent/Await

Await

scala.concurrent.Await
objectAwait

Await is what is used to ensure proper handling of blocking forAwaitable instances.

While occasionally useful, e.g. for testing, it is recommended that you avoid Await whenever possible— instead favoring combinators and/or callbacks. Await'sresult andready methods will block the calling thread's execution until they return, which will cause performance degradation, and possibly, deadlock issues.

Attributes

Source
package.scala
Graph
Supertypes
classObject
traitMatchable
classAny
Self type
Await.type

Members list

Value members

Concrete methods

finaldefready[T](awaitable:Awaitable[T],atMost:Duration): awaitable.type

Await the "completed" state of anAwaitable.

Await the "completed" state of anAwaitable.

Although this method is blocking, the internal use ofblocking ensures that the underlyingExecutionContext is given an opportunity to properly manage the blocking.

WARNING: It is strongly discouraged to supply lengthy timeouts since the progress of the calling thread will be suspended—blocked—until either theAwaitable becomes ready or the timeout expires.

Value parameters

atMost

maximum wait time, which may be negative (no waiting is done),Duration.Inf for unbounded waiting, or a finite positive duration

awaitable

theAwaitable to be awaited

Attributes

Returns

theawaitable

Throws

InterruptedException if the current thread is interrupted while waiting

TimeoutExceptionif after waiting for the specified time thisAwaitable is still not ready

Source
package.scala
finaldefresult[T](awaitable:Awaitable[T],atMost:Duration):T

Await and return the result (of typeT) of anAwaitable.

Await and return the result (of typeT) of anAwaitable.

Although this method is blocking, the internal use ofblocking ensures that the underlyingExecutionContext is given an opportunity to properly manage the blocking.

WARNING: It is strongly discouraged to supply lengthy timeouts since the progress of the calling thread will be suspended—blocked—until either theAwaitable has a result or the timeout expires.

Value parameters

atMost

maximum wait time, which may be negative (no waiting is done),Duration.Inf for unbounded waiting, or a finite positive duration

awaitable

theAwaitable to be awaited

Attributes

Returns

the result value ifawaitable is completed within the specific maximum wait time

Throws

InterruptedException if the current thread is interrupted while waiting

TimeoutExceptionif after waiting for the specified timeawaitable is still not ready

Source
package.scala
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp