LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

flush event queue and record number of events flushed

Solved!
Go to solution

Since Dr. Powell chimed in (Thanks,) I'll add my comments on Flush Event Queue as well.

 

The primitive is a bandaid, and has no practical use in code that has 1 Event loop.  It had considerably greater utility as a debug tool prior to the Event Inspector Window's introduction. 

 

It still has some uses in complex architectures.  For example I have used it in a plugin architecture with the plugins themselves being QMH launched dynamically and coordinated to the system from pre-established Dynamic user Events.  I knew that additional plug-ins would be developed with a plug-in template I provided (and I even delivered a developer walk-through video.)  What I could not guarantee was which Event loop would register for which Filter Events in what order when the number of plug-ins could not be predicted.  Flush Event Queue rescued me from having to train code maintainers on exactly how to predict Event Registration order and review the plug-in base prior to deploying each new plug-in even though I had provided a plug-in validation exe.  Simply put the maintainers could not be expected to have master LabVIEW Ninja skill.

 

I got exactly 1 call back from the manager of that client.  To pass along the team's THANKS for how easy it was to successfully ceate, validate and deploy a new plug-in.  It took a brand new CLAD with 6mo LabVIEW experience 90 minutes. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 11 of 13
(288 Views)

@JÞB wrote:

 

Modified and attached in LabVIEW 2020

A very nice use of "Bundle" rather than "Bundle by name."  Not too often you run across those.

Notes are documented in the code.


Jay, Thank you for the solution. Now that I have a solution, I need to find a problem to solve with it : ) Maybe I will start recording how many times a user clicks a button repeatedly in frustration and pop up a stress level meter on the UI as an easter egg, made a quick prototype. 

 

-J 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 12 of 13
(256 Views)

@drjdpowell wrote:

Instead of using Flush, consider this kind of structure, where one handles every Event, but only does the time-expensive operations (that don't need to be done every Event) after the Event queue is empty.  This is done using the Timeout case and a fed-back timeout that is zero.  See attached.

2022-06-05 09_29_23-No Flush Example.vi Block Diagram.png

 

This method is a lot more widely useful than using Flush, as you can gather any info you want from the Events.  In the example, I gather the info about the timing of the Wait button events).


Hello drjdpowell, I like this design pattern. It provides a quick way to do event priority queueing without making your own QMH or Actors. 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 13 of 13
(254 Views)