View Full Version : GrabberListener operation

January 6, 2006, 03:33:10
Hey guys,

I just have a quick question about how the GrabberListener works. Since this is an event based scheme, this seems (to me) to imply that there's another thread handling these callbacks and when to call them. If this is true, then the code you've posted using the m_GrabberRefTime variable could cause a problem if two threads tried to modify m_GrabberRefTime at once.

The reason I ask, is because I'm using the frameReady callback with my custom Listener class. Inside this method I use a couple protected member variables that *may* be modified in other areas of the code. For the most part everything works perfectly, but everyone once in a while I get a strange crash that's very hard for me to debug, which usually cries out some sort of thread timing issue.

So I just need some clarity.

Thanks for your time,


Stefan Geissler
January 6, 2006, 10:49:37
Hi Jeff,

You are right, the frameReady() is called by another thread. But can not called twice, the threads waits until the current frameReady returns until it is called again.
I suggest to buffer the modifies of your member variables and copy these modifies in the frameReady() to the members or local variables that are used in your image processing. So you can be sure, that no variables are modified while they are used in the frameReady() image processing.

I hope this helps, if not please let me know.