I define an array of a structs. This function runs as its own thread to process firewire video frames; ring buffer: thread per frame. In the function, I fill the array with frame information. This program starts & stops filling the array, at the starting and stopping points, dwStart & dwStop. Depending on the value of the boolean variables, set by a LED flash in the video frame, the program will write, in another thread, so it doesn't mess up the timing of the thread from which it was spawned, the array values out to a file. It looks something like...
Code:
for(int k = dwStart; k < dwStop; ++k){
OutFile << setw(6) << frame[k].Frame << setw(12) << frame[k].FrameTime << setw(12) << frame[k].ldDuration << "\n";
}
Sometimes, the last line of the information I write out is incomplete; frame number, but not the frame time or duration. Is the thread to write out begining while the (n+1) thread(frame) is in the process of fill the struct?
How could I debug this? ......hummmm
Thanks,
Matt