Overview
When using a queued message handler you may want to be sure that the message is handled within a certain amount of time. For example; you want to make sure that when an end user presses exit the application will stop, but also other messages should be handled on time.
Description
When enqueueing a message the time from the message will be send to the consumer (along side the message name and the message data). The time will also be written in a functional global (timekeeper.vi). I added this as an option to the enqueue function; a boolean input (timed message?) will write the current time or NaN.
On the other end (when dequeueing) we get the time, and if this is not NaN we will look up the time in the very same functional global. If we find the time there, the time will be deleted from the array.
I added a time out event to check if one of the queued message timers are expired. This isn't the most elegant way; perhaps it is an idea to do this in parallel (in your error handling loop).
In the code this is done by only adding a double to your message and adding a functional gloal to the library. To test this the timed message is added with the 'do something' message. The 'do domething else' message is without timing. When dequeueing the 'do something' message a time delay of 1 sec is added to make it possible to timout. The time out is set tot 10 seconds. The timout is checked 10 times every second (you can set this slower, but just for demo purposes).
This is just an idea how something like this could work, just a wild thought.....
Steps to Implement or Execute Code
Requirements
Software
LabVIEW 2013
Additional Images or Video
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.