04-01-2008 08:45 AM
Hi
I have the following setup. I have created a new thread from the default thread
pool to do my acquisition. I basically move a stage and take a camera image to
build up a large image of a region.
Each time I move the stage and get a camera image. I then
add this image to a thread safe queue.
I have also setup a callback to be called when data is
written to the queue. This callback should get called in the main ui thread I
believe, so it is where I display the images.
My problem is that the callback seems to interrupt the
acquisition thread. I.e. if I get the callback to be called when 5 items are
added to the queue the stage moves 5 times with now delay, but on the fifth
there is a delay when I remove the items from the queue and display them.
Should the acquisition thread be able to continue with any delay?
PS this is a multi processor machine.
If I put a Delay(2.0) call in the callback function it also
clearly delays the acquisition thread.
Does anyone have any ideas?
04-01-2008 04:55 PM
Hi Glenn.
It seems to me that you have set the threshold values for both the acquisition and main thread callbacks to be equal to the maximum TSQ length (which is apparently 5), so that:
This would explain the delays you have observed, and may also cause problems with handling the last few images.
I suggest you try something like this:
// In your acquisition thread:
CmtInstallTSQCallback (tsqHandle, EVENT_TSQ_QUEUE_SPACE_FREE, 1,
AcquireNextImageCallback, NULL,
CmtGetCurrentThreadID(), NULL);
// In your main thread:
CmtInstallTSQCallback (tsqHandle, EVENT_TSQ_ITEMS_IN_QUEUE, 1,
ProcessNextImageCallback, NULL,
CmtGetCurrentThreadID(), NULL);
Keep the maximum queue length as is, so that user interface activity has minimal impact on the acquisition.
Hope this helps.
Regards,
Colin.
04-02-2008 04:33 AM
04-02-2008 08:39 AM
04-02-2008 09:35 AM
04-02-2008 09:41 AM
04-02-2008 09:44 AM
04-02-2008 09:49 AM