LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CmtReadTSQData And malloc Issue

Hi Everyone! My application requires several threads running at the same time. A particular thread uses malloc exclusively, and the others only use Thread Safe Queues. I have experienced an issue when I try to call CmtReadTSQData(handle, ptr_buffer, TSQ_INFINITE_TIMEOUT, 0); meaning that I want to remove data from the TSQ and wait until this happens, unfortunately, during run time it goes into the function call and never returns. In the mean time, other threads are running making use of TSQ and only one using malloc. Would anyone have encountered such issue? Is there a way around it? Cheers.
0 Kudos
Message 1 of 2
(3,052 Views)
Hello Julio

I'm not sure what malloc has to do with this issue, but it seems that the CmtReadTSQData() function will not return unless it has read all the requested datapoints, since you have set the timeout as TSQ_INFINITE_TIMEOUT. Perhaps one thing to look into would be whether you actaully have the requested number of datapoints in the TSQ when you are trying to read it.
You can use CmtGetTSQAttribute (queueHandle, ATTR_TSQ_ITEMS_IN_QUEUE,&itemsInQueue) to check for this.

Hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 2
(3,052 Views)