Used internally by the framework;
Designates (and eventually executes) a thunk which potentially blocks the calling Thread.
Used internally by the framework;
Designates (and eventually executes) a thunk which potentially blocks the calling Thread.
Clients must use scala.concurrent.blocking or scala.concurrent.Await instead.
A context to be notified by
scala.concurrent.blockingwhen a thread is about to block. In effect this trait provides the implementation forscala.concurrent.Await.scala.concurrent.Await.result()andscala.concurrent.Await.ready()locates an instance ofBlockContextby first looking for one provided throughBlockContext.withBlockContext()and failing that, checking whetherThread.currentThreadis an instance ofBlockContext. So a thread pool can have itsjava.lang.Threadinstances implementBlockContext. There's a defaultBlockContextused if the thread doesn't implementBlockContext.Typically, you'll want to chain to the previous
BlockContext, like this: