|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread vanetsim.simulation.WorkerThread
public final class WorkerThread
This thread is meant to run parallel with multiple others to gain advantage of multiple CPUs. All simulation tasks are initiated from this class!
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
WorkerThread(Region[] ourRegions,
int timePerStep)
The main constructor for the worker thread. |
Method Summary | |
---|---|
void |
addChangedRegion(int i)
Adds a region to the list of changed region (so that it gets updated). |
void |
run()
The main method. |
void |
setBarriers(java.util.concurrent.CyclicBarrier barrierStart,
java.util.concurrent.CyclicBarrier barrierDuringWork,
java.util.concurrent.CyclicBarrier barrierFinish)
Set CyclicBarriers for thread synchronization. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public WorkerThread(Region[] ourRegions, int timePerStep)
ourRegions
- the regions which are assigned to us.timePerStep
- the time in milliseconds for one stepMethod Detail |
---|
public void setBarriers(java.util.concurrent.CyclicBarrier barrierStart, java.util.concurrent.CyclicBarrier barrierDuringWork, java.util.concurrent.CyclicBarrier barrierFinish)
CyclicBarriers
for thread synchronization.
barrierStart
- the barrier for startingbarrierDuringWork
- the barrier after adjusting the speedbarrierFinish
- the barrier after completing all taskspublic void addChangedRegion(int i)
i
- the number of the region in this threadpublic void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |