breakpoints changing thread operation

I am running code in VC++ 2010 express. I have 3-12 threads running and being controlled/sequenced by SignalObjectAndWait semaphores.
Using break points changes the program flow. Conditions that occur without BP no longer occur when a BP is placed in the code. The same code that fails also works correctly when I step through it instead of running.
The code is effectively an OS sequencer.
The applications thread should only have one running at any time, the rest are either suspended or waiting on a Sem.
There is also a timer and scheduler threads running separately. The timer occasionally releases a WaitForSingleObject Sem that allows the scheduler to run. Also adding printf's anywhere in the code also causes control changes.
Does anyone have any ideas on what is going on, or if this is fixable?
Best guess is that you're mistaken about only one thread being run at a time and that two or more are touching the same memory.
Last edited on
It also sounds like "fibers" might be a better choice for this use case: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682661(v=vs.85).aspx

Topic archived. No new replies allowed.