VANET Simulator
 All Classes Functions Variables
Public Member Functions | List of all members
vanetsim.simulation.WorkerThread Class Reference
Inheritance diagram for vanetsim.simulation.WorkerThread:

Public Member Functions

 WorkerThread (Region[] ourRegions, int timePerStep)
 
void setBarriers (CyclicBarrier barrierStart, CyclicBarrier barrierDuringWork, CyclicBarrier barrierFinish)
 
void addChangedRegion (int i)
 
void run ()
 

Detailed Description

This thread is meant to run parallel with multiple others to gain advantage of multiple CPUs. All simulation tasks are initiated from this class!

Constructor & Destructor Documentation

vanetsim.simulation.WorkerThread.WorkerThread ( Region[]  ourRegions,
int  timePerStep 
)
inline

The main constructor for the worker thread. Don't use any other constructor inherited from the Thread class as all parameters are essential!

Parameters
ourRegionsthe regions which are assigned to us.
timePerStepthe time in milliseconds for one step

Member Function Documentation

void vanetsim.simulation.WorkerThread.addChangedRegion ( int  i)
inline

Adds a region to the list of changed region (so that it gets updated).

Parameters
ithe number of the region in this thread
void vanetsim.simulation.WorkerThread.run ( )
inline

The main method. All simulation is initiated from here!

void vanetsim.simulation.WorkerThread.setBarriers ( CyclicBarrier  barrierStart,
CyclicBarrier  barrierDuringWork,
CyclicBarrier  barrierFinish 
)
inline

Set CyclicBarriers for thread synchronization.

Parameters
barrierStartthe barrier for starting
barrierDuringWorkthe barrier after adjusting the speed
barrierFinishthe barrier after completing all tasks

The documentation for this class was generated from the following file: