Class MovieDecoder.ControlThread
java.lang.Object
java.lang.Thread
org.web3d.vrml.renderer.common.input.movie.MovieDecoder.ControlThread
- All Implemented Interfaces:
Runnable
- Enclosing class:
MovieDecoder
This thread class consumes the action queue and
executes actions on the processor.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor initializes the action queue and starts the thread. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(MovieDecoder.Action action) Adds an action to the tail of the action queue, and signals the thread.void
finish()
Signals the control thread to shut down.void
run()
Entry point for the control thread.void
setState
(int stateBit) Called to set one or more state bits in the controlThread state field.stateString
(int state) Debugging code returns a string representation of a state fieldvoid
unsetState
(int stateBit) Called to clear one or more state bits in the controlThread state field.boolean
waitForState
(int wantState) Short cut for waitForState(wantState,wantState).boolean
waitForState
(int wantState, int stateMask) Waits until (state & stateMask) == wantState.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Constructor Details
-
ControlThread
public ControlThread()Constructor initializes the action queue and starts the thread.
-
-
Method Details
-
stateString
Debugging code returns a string representation of a state field- Parameters:
state
-- Returns:
-
add
Adds an action to the tail of the action queue, and signals the thread.- Parameters:
action
- - action to be performed
-
finish
public void finish()Signals the control thread to shut down. Pending actions will be discarded. This call returns immediately without waiting for the thread to terminate. -
run
-
waitForState
public boolean waitForState(int wantState) Short cut for waitForState(wantState,wantState). Waits until the state bit is set and ignores all other bits.- Parameters:
wantState
-- Returns:
-
waitForState
public boolean waitForState(int wantState, int stateMask) Waits until (state & stateMask) == wantState. Callers must ensure that stateMask is a superset of wantState or the call will never be matched. Also, to work around some of the JMF bugs, we time out if the event doesn't happen within STATE_SEMAPHORE_TIMEOUT milliseconds. This is the minimum time it will wait. The actual delay may be longer.- Parameters:
wantState
- - bit mask for bits you want setstateMask
- - bit mask for bits you want to check- Returns:
- true if the state was matched, false if it timed out.
-
setState
public void setState(int stateBit) Called to set one or more state bits in the controlThread state field. When the state changes, the controlThread will be notified if it is waiting for a state change.- Parameters:
stateBit
- - the bit (or bits) to be set.
-
unsetState
public void unsetState(int stateBit) Called to clear one or more state bits in the controlThread state field. When the state changes, the controlThread will be notified if it is waiting for a state change.- Parameters:
stateBit
- - the bit (or bits) to be cleared.
-