Creation

Example 12-1 may be the simplest possible complete program that executes something in a RealtimeThread.

Example 12-1. Creating a Basic RealtimeThread creation
import javax.realtime.*;

public class Hello1 {
  public static void main(String [] args){
    RealtimeThread rt= new RealtimeThread(){
      public void run() {
        System.out.println("Hello RT world");
      }
    };
    rt.start();
  }
}

This example creates and starts a default RealtimeThread object that should be sufficient for most purposes unless a nonpriority scheduler is active.

Since this RealtimeThread is started by an ordinary thread, it is a special case. It cannot inherit RTSJ attributes from its parent. So, since nothing is specified in its constructor, the new thread gets default values. The ...

Get Real-Time Java™ Platform Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.