LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queued Message Handler with Desktop Execution Trace- Opinion Requested

So I use a common library at my work for the Queued Message Handling. I recently started using DET and added custom traces to this library containing the message and destination. Right now, it's just a reference number so it's hard to quickly debug. So I wanted an opinion on which would be best way to approach adding a name. I have two ideas:

 

  1. Via lookup table: On obtain, store a name and reference (not obtained by name) in some flavor of global. On enqueue/dequeue, do a lookup for that reference and label the trace.
    • I get a little bit of heartburn over for a common library in user.lib containing a functional global as well as lookup time for each enqueue/dequeue function.
  2. Via queue name: On obtain, obtain by name and tack on a random number. On enqueue/dequeue, use the Get Queue Status.vi to grab the name and label the trace.
    • I have to obtain by name which is generally frowned on. If I get a sufficiently long random number there is little chance of grabbing someone's queue on accident, so I'm not sure if this alleviates this concern totally.

Let me know what you think, or if you have other ideas. Thanks.

Josh
Software is never really finished, it's just an acceptable level of broken
0 Kudos
Message 1 of 3
(2,485 Views)

While I'm not at all sure I understand why/what you are doing, I have a suggestion for Unique Queue Name -- use a Functional Global that simply increments a number and use that as (part of) the Queue Name.  As long as there's only one program running, this is guaranteed to give at least 2^32 unique values before repeating.

 

If you use a "Random String" of 8 characters, you'll get at least 26^8 values, also unlikely to lead to a clash.

 

Bob Schor

Message 2 of 3
(2,454 Views)

@Bob_Schor wrote:

While I'm not at all sure I understand why/what you are doing, I have a suggestion for Unique Queue Name -- use a Functional Global that simply increments a number and use that as (part of) the Queue Name.  As long as there's only one program running, this is guaranteed to give at least 2^32 unique values before repeating.

 

If you use a "Random String" of 8 characters, you'll get at least 26^8 values, also unlikely to lead to a clash.

 

Bob Schor


That's a good idea of using the incrementing number vs the random. If they share the same memory space and could get at each other's queues, this will prevent that. Thanks.

 

This has me leaning towards using the queue names to label the trace. This avoids a lookup table (then again, that may be what "Get Queue Status.vi" does anyway)

Josh
Software is never really finished, it's just an acceptable level of broken
0 Kudos
Message 3 of 3
(2,425 Views)