07-02-2007 08:09 AM
07-02-2007 01:07 PM
Hi kleyh,
Since you are just starting out using LabWindows/CVI, the best place to begin
is to look at our examples. In your case, you will be doing some multithreading
and thus using our Utility Library (which contains Thread Pools, Thread Safe
Queues, Thread Safe Variables, Thread Locks, Thread Local Variables, etc).
Check out the <CVI>\samples\utility\Threading\ folder which has a
good variety of examples including a ThreadSafeQueue example.
Hope this helps!
Best Regards,
07-04-2007 03:49 AM
07-05-2007 11:11 AM
07-06-2007 08:19 AM
07-06-2007 09:17 AM
Hi Heike,
The callback function for the TSQ will be called when then event you specify occurs and the threshold value you specify is exceeded. For example, with TSQ's, there are 3 possible events which are: EVENT_TSQ_QUEUE_SIZE, EVENT_TSQ_ITEMS_IN_QUEUE, and EVENT_TSQ_SPACE_FREE. In the example you posted, the event you are waiting on is the EVENT_TSQ_ITEMS_IN_QUEUE. This event will be generated when a thread writes items to the TSQ and when the number of items in the queue after the new items is added is greater than or equal to the threshold value. In the example, the threshold value was 500.
Now, there is a section in the help under the CmtInstallTSQCallback function that talks about a scenario when you might have more data in the queue than the threshold value. Read that section (it’s talked about in the event parameter) as it’s very important.
Now, if you are thinking that your TSQ callback is not getting fired, place breakpoints in your TSQ callback to make sure of that. If the breakpoint is never hit, then you know something is wrong. If the breakpoint is hit, then step through your code to make sure you are getting the correct data and writing to a file.
The overall structure of setting up your program was discussed in my earlier posts. It’s a high level view but the typical approach and you seem to be following the correct layout. Since I am not on the PXI or DAQ teams, I wouldn’t' feel comfortable giving you architecture advice on those specific areas so you might want to post in those specific forums.
In your case, breakpoints would be the best troubleshooting option which will tell you if the condition you set up for you TSQ callback is ever occurring. You could also put in DebugPrintf statements in that callback as well to help out.
Hope this helps!
Best Regards,
08-03-2007 06:43 PM