Class ThreadTask

java.lang.Object
org.jenkinsci.plugins.workflow.cps.ThreadTask
Direct Known Subclasses:
Safepoint

public abstract class ThreadTask extends Object
Execute something in at the point where all CPS threads are at a safe point.

Pass this to Continuable.suspend(Object) to have eval(CpsThread) invoked.

eval(CpsThread) can return in one of two ways.

If the eval method returns with ThreadTaskResult.resumeWith(Outcome), then the calling CPS program sees the invocation of Continuable.suspend(Object) "return" (in the async sense) with the specified outcome. This is useful if you want to keep the CPS evaluation going.

If the method return with ThreadTaskResult.suspendWith(Outcome), then the synchronous caller of Continuable.run(Object) returns with the specified outcome (which is normally what happens with Continuable.suspend(Object)) call. This is useful if you want to suspend the computation.

Author:
Kohsuke Kawaguchi
  • Constructor Details

    • ThreadTask

      public ThreadTask()
  • Method Details

    • eval

      protected abstract ThreadTaskResult eval(CpsThread cur)
      Parameters:
      cur - the current thread that requested this task.