![]() With this knowledge you should feel confident in finding a solution when the UI thread and root loop don’t want to play nice. It isn’t a bug in LabVIEW, but a consequence of OS-level messaging that can’t be avoided. The root loop is elusive, and often hard to debug or pin as the culprit for an issue within an application. While this isn’t a fully comprehensive list of all the nodes and instances that will put a VI into the UI thread or invoke the root loop, hopefully it serves as a solid base of knowledge on the topic. Keep in mind that Call by Reference when calling a Remote VI will require the UI thread on both the Client and Remote side.Avoid making calls that place the VI in the UI thread if not needed, and abstract those calls to separate VIs.Avoid using OS dialogs such as: One/Two Button Message, File Prompts, etc.Substitute Run VI with Call by Reference.Open Typed VI References ahead of time to load the VIs into memory.The following list is a good starting point for what you can implement to avoid running into issues with your application. In addition to the above information, there are special cases regarding the UI thread and root loop that might not be as obvious. So how should I take this into consideration when writing my application? If a time-critical process is running poorly, and performing UI actions (clicking, dragging windows, long-click on the title bar, opening a context menu or dialog) seem to exacerbate the situation, then there is a good chance that a portion of the time-critical process is running in the UI thread and is also victim to nodes requiring root loop. UI thread and root loop issues can be hard to track down in large applications. How can I determine that the UI thread or root loop is to blame? These include things such as the color palette selector, calendar date popup, waveform graph configuration, VISA resource selector, combo box selector, etc. The Open VI Reference scenarios boxed in red require the root loop to run. The trick to understanding the UI thread is knowing the basic processes that will require the thread, which are listed below: Click the Help button, shown at left, in the bottom right corner of the Configure Formula dialog box to display the LabVIEW Help topic for this Express VI. There is a void of documentation regarding this subject, and therefore there is no real comprehensive list of functions and VIs. The majority of nodes in LabVIEW will have no problem executing in the 20+ execution threads mentioned above, but certain nodes in LabVIEW can only execute within the UI thread. In addition to these execution threads, there exists the UI thread. For a quad-core processor LabVIEW will allocate 80 execution threads a dual-core processor has 40 execution threads, and so on. There are five execution systems in LabVIEW, and each execution system allocates four threads for execution, per processor core by default. LabVIEW is a naturally multithreaded application and it dynamically allocates these threads. You may have never heard of the UI thread or the root loop, but as a revision to the old adage goes, what you don’t know can hurt you.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |