Computer freezing up on wait
-
The application I am working on, call it Main, starts up another executable, call it Sub, and the two share an event. The event is created in Main before Sub starts, and then opened in Sub. The problem I am having in debugging them is that if Main hasn't reset the event, Sub freezes the computer, to the point where the only way I can recover is to power-down. The freeze happens here:
while (WaitForSingleObject(hAcquireActive, 100)==WAIT_OBJECT_0) { Sleep(1000); }
I tried something slightly different by creating an event to use in place of the Sleep, but it freezes the computer in the same way. That code is:HANDLE waitForeverEvent; waitForeverEvent = CreateEvent(NULL, FALSE, FALSE, "forever"); while (WaitForSingleObject(hAcquireActive, 100)==WAIT_OBJECT_0) { WaitForSingleObject(waitForeverEvent, 1000); }
Environment is : Windows XP Professional, Visual Studio 2003. Any explanation for why the computer is freezing, and/or a better way to wait for the hAcquireActive event to be reset while I am debugging? Thanks. -
The application I am working on, call it Main, starts up another executable, call it Sub, and the two share an event. The event is created in Main before Sub starts, and then opened in Sub. The problem I am having in debugging them is that if Main hasn't reset the event, Sub freezes the computer, to the point where the only way I can recover is to power-down. The freeze happens here:
while (WaitForSingleObject(hAcquireActive, 100)==WAIT_OBJECT_0) { Sleep(1000); }
I tried something slightly different by creating an event to use in place of the Sleep, but it freezes the computer in the same way. That code is:HANDLE waitForeverEvent; waitForeverEvent = CreateEvent(NULL, FALSE, FALSE, "forever"); while (WaitForSingleObject(hAcquireActive, 100)==WAIT_OBJECT_0) { WaitForSingleObject(waitForeverEvent, 1000); }
Environment is : Windows XP Professional, Visual Studio 2003. Any explanation for why the computer is freezing, and/or a better way to wait for the hAcquireActive event to be reset while I am debugging? Thanks.Does this describe your problem? PRB: Synchronization Failure When Debugging
:suss: Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
-
Does this describe your problem? PRB: Synchronization Failure When Debugging
:suss: Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
Thank you for finding that. Somewhat, but the same thing happens when running a release version outside of Debug. I am looking into the possibility that it is a bus problem caused by one of the cards in the system.
-
The application I am working on, call it Main, starts up another executable, call it Sub, and the two share an event. The event is created in Main before Sub starts, and then opened in Sub. The problem I am having in debugging them is that if Main hasn't reset the event, Sub freezes the computer, to the point where the only way I can recover is to power-down. The freeze happens here:
while (WaitForSingleObject(hAcquireActive, 100)==WAIT_OBJECT_0) { Sleep(1000); }
I tried something slightly different by creating an event to use in place of the Sleep, but it freezes the computer in the same way. That code is:HANDLE waitForeverEvent; waitForeverEvent = CreateEvent(NULL, FALSE, FALSE, "forever"); while (WaitForSingleObject(hAcquireActive, 100)==WAIT_OBJECT_0) { WaitForSingleObject(waitForeverEvent, 1000); }
Environment is : Windows XP Professional, Visual Studio 2003. Any explanation for why the computer is freezing, and/or a better way to wait for the hAcquireActive event to be reset while I am debugging? Thanks.What happens in your main program AFTER the while loop? Since you only check for WAIT_OBJECT_0, if the hAcquireActive is not signaled within 100ms then your wait will return with WAIT_TIMEOUT and oyu will not enter your while loop. Could this be your problem?
-
What happens in your main program AFTER the while loop? Since you only check for WAIT_OBJECT_0, if the hAcquireActive is not signaled within 100ms then your wait will return with WAIT_TIMEOUT and oyu will not enter your while loop. Could this be your problem?
Blake, Good thinking, based on the amount of code I posted. I probably should have put more of the preceding code. The way the 2 interact, the Sub code - which is the one that was hanging on the sleep - has just set the event and checked that it is indeed set. Then comes the code I posted which is waiting for it to be reset by Main. If it has been reset, then there is no need to go into the loop. During the debugging process, I took main out of the picture - created the event in Sub - and added some other lines inside the loop to guarantee things were for sure freezing on the Sleep or WaitForSingleObject, and they were. The problem turned out to be a bad hotlink receiver card. It was replaced and now the problem is gone. The specifics of why it manifested that way I don't know. Since it works now, move on ... In hindsight, since it was freezing to the extent the system had to be powered down, I might have more quickly ruled out that it was a coding problem. Thanks for your help.
-
Does this describe your problem? PRB: Synchronization Failure When Debugging
:suss: Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
Jack, Turned out to be bad hotlink receiver card. Thanks again for your help.
-
Does this describe your problem? PRB: Synchronization Failure When Debugging
:suss: Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
Now that was SERIOUSY cool to know. Thanks a ton :cool: