Download technical manual

Transcript
CHAPTER 4. AVP ENGINE THREAD
StateFilterParams
VehicleState_TF
VehicleVel_VF
64
VehicleState_TF
Vehicle_Vel_VF
VehicleState_TF
VEhicleVel_VFRaw
StateFilter
Figure 4.9: Data Flow Diagram for CStateFilter
thereby giving access to the external thread's data. However, if the external thread is
modifying its data at every iteration, the data must be protected from reading by external
threads at improper times, and from writing by more than one thread at once. Semaphores
can be used to accomplish this. A client thread calls a server thread method that blocks
until the external thread triggers a certain event (such as the end of an iteration). At this
point, the client thread calls server thread methods that get or set certain variables. To
enforce mutual exclusion, these access methods lock the variables against use by the server
thread until the client has get/set the data. Using this model, CAVPEngineThread is the
server thread, while all other threads in the application are client threads that pend on every
iteration through the sample loop. In this fashion, other threads can get/set data at every
iteration (synchronously), although it is not guaranteed that the other threads will nish
their tasks in time to receive data from the very next iteration (i.e. reliable communication