LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Threading Bug

Hi,

I am writing an application that downloads data from the internet using threads. I use thread callback functions extensively and from the callback function I will often create new download threads to download addition data (ie: pictures, data, etc that are links from the first data).

Every so often I get a crash bug that I can't debug. So, I modified the simple OnePanel.c example to behave more like my program. Instead of a while(1) loop, each thread loops 100 times, and then a new thread is created in the callback function. 75% of the time when I run this code I will get a similar crash if I click on the 'new thread' button often.

Any ideas?

Thank you,
Alan
0 Kudos
Message 1 of 4
(2,886 Views)
This crash somehow seems to be related to schedule a threadpool function using the callback. If you set the callback parameter to NULL, you dont seem to get the crash anymore. I'll forward this bug report to R&D for further investigation.

Thanks

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 4
(2,884 Views)
Is there a workaround or a fix for this?
0 Kudos
Message 3 of 4
(2,842 Views)
I used the Thread Safe Queue mechanism to queue up a pointer to a structure that included the callback pointer. I was able to simulate a callback by queueing up the callback at the end of the thread function. This seems to work pretty well.

Alan
0 Kudos
Message 4 of 4
(2,822 Views)