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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.