give avian/Continuations a private constructor; documentation tweaks

This commit is contained in:
Joel Dice 2009-05-31 14:16:51 -06:00
parent 9d6a3021ca
commit 01f302d4b5

View File

@ -29,7 +29,7 @@ import java.util.concurrent.Callable;
* <p>This class provides two static methods, * <p>This class provides two static methods,
* <code>callWithCurrentContinuation</code> and * <code>callWithCurrentContinuation</code> and
* <code>dynamicWind</code>, with similar semantics to the Scheme * <code>dynamicWind</code>, with similar semantics to the Scheme
* methods <code>call-with-current-continuation</code> and * functions <code>call-with-current-continuation</code> and
* <code>dynamic-wind</code>, respectively. In addition, we define * <code>dynamic-wind</code>, respectively. In addition, we define
* how continuations work with respect to native code, exceptions, * how continuations work with respect to native code, exceptions,
* try/finally blocks, synchronized blocks, and multithreading. * try/finally blocks, synchronized blocks, and multithreading.
@ -96,32 +96,30 @@ import java.util.concurrent.Callable;
* *
* <p>The call stack of a continuation may share frames with other * <p>The call stack of a continuation may share frames with other
* continuations - in which case they share a common history. When * continuations - in which case they share a common history. When
* calling a continuation "B" from the current continuation "A", we * calling a continuation "B" from the current continuation "A", the
* must unwind past any frames which are in "A" but not in "B" and * VM must unwind past any frames which are in "A" but not in "B" and
* rewind past any frames in "B" but not in "A". During this * rewind past any frames in "B" but not in "A". During this
* unwinding and rewinding, we may pass through synchronized and * unwinding and rewinding, control may pass through synchronized and
* try/finally blocks while going down the old stack and up the new * try/finally blocks while going down the old stack and up the new
* stack. * stack.
* *
* <p>However, unlike the traditional processes of winding and * <p>However, unlike the traditional processes of winding and
* unwinding, the VM will ignore these blocks - monitors will not be * unwinding, the VM will ignore these blocks - monitors will not be
* released or acquired and finally blocks will not execute. This is * released or acquired and finally blocks will not execute. This is
* by design. The purpose of such a block is to acquire a resource * by design. The purpose of such a block is to acquire a resource,
* before executing a task and release it when the task is done. With * such as a file handle or monitor, once before executing a task and
* continuations, we may wish to yield control temporarily to another * release it after the task is finished, regardless of how often the
* continuation while executing such a task, and we might do so * task might temporarily yield control to other continuations.
* several times. In such a case we would only want to acquire the
* resource when we start the task and only release it when we're
* finished, regardless of how often we unwound to reach other
* continuations or rewound to the next step.
* *
* <p>Conversely, we may wish to acquire and release a resource each * <p>Conversely, one might wish to acquire and release a resource
* time we (re)wind to or unwind from a continuation, respectively. * each time control (re)winds to or unwinds from a continuation,
* In this case, we use <code>dynamicWind</code> to register functions * respectively. In this case, we use <code>dynamicWind</code> to
* which will run every time that frame is passed, regardless of how * register functions which will run every time that frame is passed,
* the stack is wound or unwound. * regardless of how the stack is wound or unwound.
*/ */
public abstract class Continuations { public class Continuations {
private Continuations() { }
/** /**
* Captures the current continuation, passing a reference to the * Captures the current continuation, passing a reference to the
* specified receiver. * specified receiver.