Handling Linux System Signals in LabVIEW

Updated May 3, 2018

Reported In

Software

  • LabVIEW

Operating System

  • Linux

Issue Details

The usual behavior of LabVIEW on Linux is that a LabVIEW application performs a predetermined action when a signal is received. For example, LabVIEW will quit when a SIGTERM is received. How can I handle these signals in LabVIEW rather than taking the default action? Using the previous example, how do I catch the SIGTERM signal so that I can perform application cleanup operations before LabVIEW exits?

Solution

While this functionality does not exist natively in LabVIEW, Linux provides functions that can be used to change the default signal handler for an application. Specifically, the sigaction() function would be the way to change this. 

From a LabVIEW perspective there is no way to easily use this function directly. Instead, it is recommended that users create a shared library using some other language which:

  1. Contains a function which calls the sigaction() function to set up the new signal handler.
  2. Contains a function that will be the new signal handler. 

The new signal handler function can then be configured to communicate with LabVIEW upon receipt of the specified signal. For example, a reference to a User Event or Occurrence can be passed to the shared library and used to trigger a corresponding action in LabVIEW upon receipt of the signal.

Additional Information

For more detailed information on Linux signal types and using the sigaction() function, it is best to refer to Linux documentation and other similar resources. These are Linux operating system related topics, and not specific to LabVIEW in any way. 

Regarding the handling of LabVIEW User Events and Occurrences in external code, refer to the LabVIEW Manager function help. Specifically the PostLVUserEvent() and Occur() functions. 

WAS THIS ARTICLE HELPFUL?

Not Helpful