Original Post
I'm using VC++ and OpenGL. The question is a little complicated. I have data that needs processing. I get a message to update my screen at regular intervals. When I get this message, I have to draw my screen and finish processing any data left over. This data is incorporated into what I draw. I want to keep my CPU load spread out over time between getting these messages. I could easily just process ALL the data at once every time I get the update message. However, I get these hard spikes in CPU. I have this "clock" thread which gets a signal from hardware. Each time this thread gets a trigger signal, it sends a SetEvent to my data processing thread. My data processing thread uses a WaitOnObject for this signal. The clock thread is set to be time critical because it uses a physical device to get its signal. The data process thread is set to normal. Sorry for huge buildup. The problem I have is when I get the render screen message. When I get it, I have only processed a quarter of my data. Yet, the "clock" thread has signaled (SetEvent) to all the data. I was given more signals to process data than actual data processed. I tried setting both threads to time critical, but it didn't seem to help. Thanks for any help. I know it's strange problem.