Class RealtimeThread

java.lang.Object
com.codename1.realtime.RealtimeThread

public final class RealtimeThread extends Object

A thread that runs a RealtimeTask once per period. Created and started by Realtime.start(String, RealtimeParameters, RealtimeTask).

The thread applies its scheduling, runs the task's setup(), freezes allocation and then loops: wait for the next release, run cycle(). stop() ends the loop after the cycle in progress.

  • Field Details

  • Method Details

    • getName

      public String getName()
      The name given at start.
    • getState

      public int getState()
      One of the STATE_ constants.
    • getFailure

      public Throwable getFailure()
      What ended the task when getState() is STATE_FAILED, otherwise null.
    • isSchedulingApplied

      public boolean isSchedulingApplied()
      true when the operating system granted real-time scheduling. false on a platform without it, or a process without the privilege, where the task runs at normal priority.
    • isCpuPinned

      public boolean isCpuPinned()
      true when the thread was pinned to the CPU its parameters named.
    • getStatistics

      public RealtimeStatistics getStatistics()
      A snapshot of the thread's statistics, as of the last completed cycle.
    • stop

      public void stop()
      Ends the loop after the cycle in progress. The thread then calls the task's stopped() and exits. Returns at once; use join(long) to wait.
    • join

      public void join(long millis) throws InterruptedException

      Waits for the thread to exit.

      Parameters
      • millis: the longest to wait, 0 for no limit
      Throws:
      InterruptedException