Jump to content

Pass data via user event with reference or actual data?


Recommended Posts

Sorry, I'm sure this is covered somewhere, but a quick search didn't find it.

I need to send data from one loop to another. I'm going to generate a user event so the second loop can use a dynamic event to respond to the incoming data. Is it better to send the actual data (which consists of a few clusters with about 10 components in them) or references to the clusters?

George

Link to comment

Sorry, I'm sure this is covered somewhere, but a quick search didn't find it.

I need to send data from one loop to another. I'm going to generate a user event so the second loop can use a dynamic event to respond to the incoming data. Is it better to send the actual data (which consists of a few clusters with about 10 components in them) or references to the clusters?

George

If by "references" you are refering to control references, then pass the data.

Ben

Link to comment

Sorry, I'm sure this is covered somewhere, but a quick search didn't find it.

I need to send data from one loop to another. I'm going to generate a user event so the second loop can use a dynamic event to respond to the incoming data. Is it better to send the actual data (which consists of a few clusters with about 10 components in them) or references to the clusters?

George

Just out of curiousity, but why would you think about sending references to the clusters instead of the actual data itself? It just seems kind of complicated to send the references.

Link to comment
Just out of curiousity, but why would you think about sending references to the clusters instead of the actual data itself? It just seems kind of complicated to send the references.

Sending the reference could give you more control - you could send different references at different times. Also, you might want to manipulate more than the data (properties for example). But I agree with PaulG. - if it's always the same cluster and you only want to work on the data, then just send the data.

Link to comment

Just out of curiousity, but why would you think about sending references to the clusters instead of the actual data itself? It just seems kind of complicated to send the references.

I'm not sure why you say it would more complicated to send the references. Just right click on the cluster to create a reference and send that. It seemed a little cleaner.

I wasn't sure which way would be faster, create fewer data copies, etc.

George

Link to comment

I'm not sure why you say it would more complicated to send the references. Just right click on the cluster to create a reference and send that. It seemed a little cleaner.

I wasn't sure which way would be faster, create fewer data copies, etc.

George

Mot much in it really. Labview nowadays creates copies of things if there is a Y in the day and you've just exhaled. The main advantage of data over refs is that data is much easier to debug since you can probe it directly to see the data.

Link to comment

I'm not sure why you say it would more complicated to send the references. Just right click on the cluster to create a reference and send that. It seemed a little cleaner.

I wasn't sure which way would be faster, create fewer data copies, etc.

George

The primary benefit of passing the data directly as opposed to using references is that you avoid race conditions. Once you pass the data via a reference you introduce the possibility of race conditions in your application. They can be very difficult to track down and debug.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.