View Full Version : Race condition between frameReady() and deviceLost()?

March 19, 2010, 09:25:45

I recently implemented the deviceLost() method in my GrabberListener-derived class, in addition to frameReady(). The trick is that I have two grabbers notifying the same GrabberListener. For this reason I have a critical section that is taken at some point inside my frameReady() method, to avoid concurrent access to the shared structures. I also have to take this same critical section in the deviceLost() callback.

I noticed that I sometimes (not always) get a deadlock when I disconnect a device. So my question is: is there some kind of race condition between the calls to deviceLost() and frameReady()? Should I find a way to let deviceLost() complete without waiting on pending frameReady() calls?

Also, is it ok to make calls to OutputDebugString() for Debugging in these callbacks?

Stefan Geissler
March 19, 2010, 10:11:33

I never checked this constellation on my own, thus I can not say anything about racing conditions.

You can use OutputDebugString() for debugging.

If the problem stays, you may open a support case at http://www.imagingcontrol.com/en_US/support/case/ so you can send a sample project.