LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW 7.0 CLFN run in its own thread

I am using LabVIEW 7.0, and have taken a number of DLL functions and drawn LabVIEW wrappers using the CLFN. One particular function waits for hardware interrupts, and the timeout options are -1, 0, or n milliseconds. A timeout of -1 will block and wait indefinitely. In LabVIEW 8.x there is a configuration option for the CLFN of "Run in UI Thread" or "Run in any thread". Because this is a blocking function we would not want it to run in the UI thread, but prior to LabVIEW 8 the options were to run in UI thread or make reentrant (not quite the same thing). I have it configured for reentrant but keep getting the blue screen of death if multiple interrupts occur near simultaneously (note that if I set the timeout to 0 this works fine - just that you are continueally polling) somehow the blocking function is hosing us up. Is there anyway to get a multithread configuration of a CLFN in LabVIEW 7.0 or is there a known workaround for a case like this.
 
thanx
Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 1 of 4
(2,732 Views)


lmd2 wrote:
I am using LabVIEW 7.0, and have taken a number of DLL functions and drawn LabVIEW wrappers using the CLFN. One particular function waits for hardware interrupts, and the timeout options are -1, 0, or n milliseconds. A timeout of -1 will block and wait indefinitely. In LabVIEW 8.x there is a configuration option for the CLFN of "Run in UI Thread" or "Run in any thread". Because this is a blocking function we would not want it to run in the UI thread, but prior to LabVIEW 8 the options were to run in UI thread or make reentrant (not quite the same thing). I have it configured for reentrant but keep getting the blue screen of death if multiple interrupts occur near simultaneously (note that if I set the timeout to 0 this works fine - just that you are continueally polling) somehow the blocking function is hosing us up. Is there anyway to get a multithread configuration of a CLFN in LabVIEW 7.0 or is there a known workaround for a case like this.
 
thanx


The reentrant selection in LaVIEW 7 really is about the same as what you get in LabVIEW 8. It's as far as I can say more a naming correction they did than a chance of functionality.
 
That you do get the BSOD indicates that the problem is actually happening in the device driver itself. If it would be in the user DLL that you access through the CLN you would get a GPF dialog instead. While I can't fully exclude the possiblity that there might be something wrong in terms of setting up the multithreading environment when entering and leaving the Call Library Node, the real problem is quite likely in the device driver itself, doing something illegal when a user application has registered one or more event notifications to be triggered when your interrupt occurres.
 
If you do have access to the device driver source code I would check that out and if not, you should talk to the person that is responsible for the device driver.
 
Rolf Kalbermatter


Message Edited by rolfk on 08-04-2008 07:08 PM
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 4
(2,721 Views)

Thanks Rolf

(I finally got those wrapper functions written for handling the pointer-to a pointer to a STRUCT, working fine - now this)

yes I just spoke with my client and they said I may have revealed a bug in their code, they are looking at their end.

So was I correct to configure the blocked function as reentrant(?), or is that not an issue either way. The blocked (waiting) function is in a while loop waiting for a data packet to be available, while in a seperate loop I am reading off a terminal stack. You think this should be do-able (assuming their code is ok)?

Thanx for your help in the past, and now again,

lmd2

Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 3 of 4
(2,712 Views)


lmd2 wrote:

Thanks Rolf

(I finally got those wrapper functions written for handling the pointer-to a pointer to a STRUCT, working fine - now this)

yes I just spoke with my client and they said I may have revealed a bug in their code, they are looking at their end.

So was I correct to configure the blocked function as reentrant(?), or is that not an issue either way. The blocked (waiting) function is in a while loop waiting for a data packet to be available, while in a seperate loop I am reading off a terminal stack. You think this should be do-able (assuming their code is ok)?

Thanx for your help in the past, and now again,

lmd2


Yes I think reentrant is really equivalent to the "Run in any Thread" in 8.x. It's naming was taken from the VI configuration which basically means the same. You do not want to run a blocking external code in the UI Thread EVER as it will virtually lock up your entire LabVIEW program until the function returns.
 
Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 4
(2,707 Views)