public class ThreadRun
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Class and Description |
---|---|
static interface |
ThreadRun.Step |
Modifier and Type | Field and Description |
---|---|
private boolean |
bIsNotified |
private boolean |
bThreadWaits |
protected int |
ctTimeoverflow |
private int |
cycletime |
private java.lang.String |
name |
private int |
nextCycle |
private java.lang.Runnable |
run |
private boolean |
runThread
If this variable is true, the thread runs.
|
private ThreadRun.Step |
step
The step routine.
|
protected int |
stepTimeMeasure |
protected float |
stepTimeMeasureMid |
protected boolean |
stopThread
Helper variable to stop one or more threads without changing the source.
|
private java.lang.Thread |
thread |
static int |
version
Version, history and license.
|
private int |
waitMillisec
The cyclically wait.
|
Constructor and Description |
---|
ThreadRun(java.lang.String name,
ThreadRun.Step step,
int cycletime) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this thread.
|
void |
forceStep(boolean forceNextStep)
Force the execution of step of this thread invoked from another thread.
|
protected void |
run()
The threads run routine.
|
void |
start() |
public static final int version
private final java.lang.Thread thread
private final java.lang.String name
protected boolean stopThread
private boolean runThread
private boolean bThreadWaits
private boolean bIsNotified
private int waitMillisec
protected int ctTimeoverflow
protected int stepTimeMeasure
protected float stepTimeMeasureMid
private final int cycletime
private int nextCycle
private final ThreadRun.Step step
private final java.lang.Runnable run
public ThreadRun(java.lang.String name, ThreadRun.Step step, int cycletime)
public void start()
public void forceStep(boolean forceNextStep)
forceNextStep
- if it is in its step-routine, it does not wait after the current step
but starts the next step immediately. If it is in its wait cycle, this value effects nothing.public void close()
step
-routine will finished or if the thread waits yet.
If the thread waits it will be waken up to finish.
If the step routine hangs or has its own timing, waits of anything other etc.
the close action is delayed. Not that a step routine should not hang in a proper application.close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
Closeable.close()
protected void run()
Runnable.run()