01-21-2008 09:56 AM - edited 01-21-2008 09:59 AM
01-21-2008 10:02 AM
If that is a normal Global, I would first look for a race condition caused by two writters of the global.
Ben
01-21-2008 10:06 AM
01-21-2008 10:22 AM
In a general sense yes.
But if that is reaally the issue you are reporting, well it depends on how your code is written. I posted an example in my Action Engine Nugget that showed how race conditions can occur with Globals. The simlest answer is to make sure you only have a single writer of your global.
Ben
01-21-2008 10:29 AM
01-21-2008 12:23 PM
Concider the following
A.VI reads from global, mods data and writes back to global
B.VI does the same.
If execution breaks down in multiple threads as
A.Vi reads
B.VI reads
A mods
B mods
A write back to global
B writes back to global
then the changes made by A are over-written by B.
Ben
01-22-2008 01:16 AM
01-22-2008 08:46 AM
I Graziano,
I don't know how much can it cost to you, but instead of global variables I strongly suggest functional global variable.
This way it's easier to deal with potential race condition.
You can use the following link to have a tip about functional global.
Basically is a sort of state machine that execute only one case for each call.
Improving Determinism with Functional Globals, LabVIEW 2-Style Globals, in LabVIEW Real-Time
Have a Good Day
Best regards
01-22-2008 08:55 AM - edited 01-22-2008 08:57 AM
Yes Functional Global or Action Engine will prevent race conditions for shared data structures.
I wrote about AE's in my Action Engine Nugget where I also included a demo of how race conditions can occur using globals.
And while I am plugging Nuggets, in this Nugget by tst, we talked globals to death and I am still convinced "Globals are Evil" (Copyright tst).
Ben
01-22-2008 09:51 AM