Class SimpleTask

  • All Implemented Interfaces:
    java.lang.Runnable, EventSubscriber, Fiber.Worker

    public class SimpleTask
    extends Task
    Spawn a task, communicate through a shared mailbox. The task's termination is known through another mailbox. The structure of this class is not much different from a Thread version that uses PipedInput/OutputStreams (Task instead of Thread, execute() instead of run(), and typed, buffered mailboxes instead of pipes). [compile] javac -d ./classes SimpleTask.java [weave] java kilim.tools.Weave -d ./classes kilim.examples.SimpleTask [run] java -cp ./classes:./classes:$CLASSPATH kilim.examples.SimpleTask
    • Field Detail

      • mb

        static Mailbox<java.lang.String> mb
    • Constructor Detail

      • SimpleTask

        public SimpleTask()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • execute

        public void execute()
                     throws Pausable
        The entry point. mb.get() is a blocking call that yields the thread ("pausable")
        Specified by:
        execute in interface Fiber.Worker
        Overrides:
        execute in class Task
        Throws:
        Pausable