Task
- Authors
杨博 (Yang Bo)
Type members
Types
Value members
Concrete methods
@inline
Returns a task that does nothing but let the succeeding tasks run on
executionContext
Returns a task that does nothing but let the succeeding tasks run on
executionContext
- Example
All the code after a
!switchExecutionContext
should be executed onexecutionContext
import com.thoughtworks.dsl.macros.Reset.Default.* import com.thoughtworks.dsl.domains.Task import org.scalatest.Assertion import scala.concurrent.ExecutionContext import com.thoughtworks.dsl.keywords.Shift def myTask: Task[Assertion] = Task { val originalThread = Thread.currentThread !Shift(Task.switchExecutionContext(ExecutionContext.global)) Thread.currentThread should not be originalThread } Task.toFuture(myTask)
Converts a Task to a scala.concurrent.Future.
Converts a Task to a scala.concurrent.Future.
- See also
keywords.Await for converting a scala.concurrent.Future to a Task.