11-18-2008 09:17 AM
Hi
I've got a problem with "Enqueue Element.vi".
My program is writing strings to queue in first while-loop and reading these strings from the queue in second while-loop.
The problemm is, almost each new element will be writen in the queue two times and therefore there are almost two times more strings in the second while loop.
In case of "highlight execution" (the yelow lamp on) it works very well. In normal execution it works wrong, though the new string comms only one time per second to queue.
Thank you in advance!
Dimitri Karch
11-18-2008 09:22 AM
If something works with highlight execution, but doesn't work in normal execution, that is usually a sign of a race condition.
It is difficult to give you any more advice unless you post your VI so we can take a look at it.
11-18-2008 09:36 AM
11-18-2008 11:07 AM
Thank you for response 🙂
My program is quite large... It should receive a UDP-Message at Ethernet-Network Intrface, analyse it and then send further through other two network interfaces.
11-18-2008 11:23 AM - edited 11-18-2008 11:23 AM
It's a little too large for me to understand quite yet.
But here are two tips.
1. Why do you have a while loop in the lower center running 10 times/second that reads from a terminal and writes to a local variable of that terminal? You are just writing a value back to itself. It is like saying x=x in a text based language. It could also be the source of your race conditions. If you are writing a value to the same local variable elsewhere, it could be competing with this bit of code which would be writing stale information into it. You can get rid of that entire while loop. Use the free terminals in place of a local variable elsewhere in the code. As it is, there are too many local variables being used throughout the code, so any of them could be causing you problems with race condtions.
2. You can consolidate your initialization frame. The Index Array function is expandable by dragging down the bottom border. Instead of indexing 1, then 2 , then 3. Use one index array structure. Write a 1 to the index. Drag down the border, you will have multiple outputs that will be 1, 2, 3, 4, .... in order.
11-18-2008 01:39 PM
Oh, the second tip is real great for me! I didn't know that trick. Thank you!
With lower central while-loop, you are right - was my mistake. I've remove it.
Unfortunately the bug is still here. I'l try to check the local variables.
11-19-2008 04:32 AM
I'm sorry! The queue isn't the reason of the bug.
It's somthing wrong with UDP-receiving. I've minimized my receiver-program and also attached the sender compatible to it.
You would maybe take a look at it. I just cannot understand what's wrong!
Thank you in advance!
Dimitri