LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to process multiple .NET events?

Hello.

 

I need to process data from multiple .NET events I'm registered to.

For that purpose I have written a single VI, called "process_callback_data.vi".

I would like to call this single VI from each of my .NET event callback VIs.

 

The problem is that the events can happen at the same time, causing a concurrently access to "process_event_data.vi".

It might happen that event A calls "process_event_data.vi" and event B calls it again, before it has finished processing event A.

I guess this is why the application builder throws an error 1502.

I need to synchronize my events somehow.

 

Any suggestions how to do that?

 

 

0 Kudos
Message 1 of 4
(2,674 Views)

It sounds like you're confusing two unrelated issues.  The application builder doesn't know anything about the logic of your code, so what you're doing with .NET events is most likely unrelated to the build error.  Have you searched this forum for that error number?  Can you post the entire text of the error message?

 

Callback VIs should be reentrant, meaning you may have multiple copies executing at a time.  If you need to process the events sequentially, have the callback VIs put an item into a queue or generate a user event so that some other VI (such as an event handler that runs continously waiting for new events) can deal with it.

0 Kudos
Message 2 of 4
(2,661 Views)

This is the full error message:

 

Error 1502 occurred at AB_Source_VI.lvclass:Close_Reference.vi -> AB_Build.lvclass:Save.vi -> AB_Build.lvclass:Copy_Files.vi -> AB_Application.lvclass:Copy_Files.vi -> AB_EXE.lvclass:Copy_Files.vi -> AB_Build.lvclass:Build.vi -> AB_Application.lvclass:Build.vi -> AB_EXE.lvclass:Build.vi -> AB_Engine_Build.vi -> AB_Build_Invoke.vi -> AB_Build_Invoke.vi.ProxyCaller

Possible reason(s):

LabVIEW:  Cannot save a bad VI without its block diagram.

0 Kudos
Message 3 of 4
(2,642 Views)

Looks like I've found a solution now.

I pass a queue reference to my callbacks, and the callbacks are putting the event data directly into that queue.

I think the point is that I don't call any other VI in my callback VIs now.

0 Kudos
Message 4 of 4
(2,636 Views)