Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Messages hogging user thread

Hi,

  Sorry if this is a basic question, but I am still pretty new to Actor. 

 I am reading video data as an array and displaying it on the screen in a chart.

Initially I was calling the driver from in the event handler, for simplicity, but this was hogging the user thread and slowing down button clicks, so I moved it to a Message which was called from the event handler. However, the same result, it slowed the response to user inputs.  Then I removed the message call completely and added a timed message call to the  Pre Launch VI. This then updates the chart by reference.  BUT the result is the same.

 

  I know that it is the driver which is slowing the code because, I set a finite number of repetitions in the timer call (20).  After twenty calls the VI sped up back to normal speed. 

 

Any thoughts please?  I will get some screen shots. 

 

  Regards,

 

  Ian

 

0 Kudos
Message 1 of 2
(2,245 Views)

Do this as a test:

Make a vi that reads from the driver in a loop and shoves the data into a global variable.  In your program that you're debugging, remove any calls to the driver and just read from that global variable.   Run both at the same time.  Is the UI responsive?  If so, then the good news is that the driver isn't hogging the UI thread, it just takes awhile to call and you're calling it in places where it's slowing down your UI.  So you just don't want to be calling that driver from within your actors message handlers and within the event loop of Actor core.  

 

So, you can create a "helper loop" inside actor core (its own dedicated loop) and a transport mechanism (e.g. Queue) 

 

Or better yet, you can create a new Actor (e.g. Video Data Reader Actor) which does nothing more than reads data from the driver, and sends that data to it's parent via a message.  You can then instantiate that actor from the Actor that's currently giving you trouble 

 

Now, if the test I told you to run still has a lagging UI, then it's a whole different story, but, I'm fairly certain that won't be the case.

0 Kudos
Message 2 of 2
(2,220 Views)