LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem stopping very simple Queued Message Handler

Solved!
Go to solution

Sorry, linked wrong image.

0 Kudos
Message 11 of 19
(1,994 Views)

If you've already removed the dequeue inside the case structure in the consumer loop, the next step is to make sure you're actually getting into the stop case in your consumer.  probe the output of the dequeue and highlight execution.  Do you actually go into that case?

CLA, CTA
Not my tempo... AGAIN!
0 Kudos
Message 12 of 19
(1,988 Views)

GarryG - I updated the jpg on the previous page to show the new Dequeue. I just grabbed the wrong image.

 

Here's the new VI if you want to run it yourself. You can get the controls from my first post.

Here is the front panel after Stop has been pressed. You can see that the state at the case structure is Stop.

FrontPNL.jpg

 

 

0 Kudos
Message 13 of 19
(1,984 Views)

Attach your control (typedefs).

CLA, CTA
Not my tempo... AGAIN!
0 Kudos
Message 14 of 19
(1,971 Views)

They are the same as the ones in my first post.

0 Kudos
Message 15 of 19
(1,967 Views)
Solution
Accepted by RossM

The problem is still there, you are trying to read a message from your queue AFTER you have read the stop message which is the last message in the queue so you are waiting for another message to arrive before you can stop the consumer. If you add a timeout to your second dequeue or simply remove it you should not have any problems.

 

Why do you need two dequeues in the consumer anyway? You are only going to be losing data by doing that, the appropriate way to do that would be to take the data retrieved from the first dequeue and pass all of that into the case structure to be handled.

 

You can tell that you are not getting into the case structure as your message string out is not updating.

Message 16 of 19
(1,965 Views)
Solution
Accepted by RossM

Check out the updated code.

CLA, CTA
Not my tempo... AGAIN!
Message 17 of 19
(1,958 Views)

OK, I think I'm getting this. Thanks Garry, it works now.

Updated code:

Updatequeue.jpg

Message 18 of 19
(1,954 Views)

The lesson to be learned here is that you should only ever have 1 Dequeue Element for a given queue.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 19 of 19
(1,919 Views)