This may help some....
On Wed, 26 Nov 2003 23:50:22 +0100, robert_s wrote on Re:
Multithreading issue:
A couple of days ago, I wrote about a goal I need to achieve
in programming a rack for radar transponders:
>I have built a simplified version of what I want to do, but
>it does not work as expected: full screen VI A has an
>indicator that displays global variable V, and a button that
>launches modal VI B. In VI B, a command modifies global
>variable V. VI B's window is centered on the screen, but the
>indicator in VI A is visible. When modifying variable V from
>VI B, nothing happens on VI A' indicator until after I close
>VI B. Obviously this is not what I want to do...
>
>I tried to remove VI B's "modality" but this does make the
>problem disappear.
After carefully reading the docs, I ran many tests in order
to have two VIs, one caled by the other, to multitask
gracefully. As I said above, I never could make this happen,
particurlarly by enabling multithreading, affecting
different threads of execution to each VIs, playing on
execution priority, etc.
A friend who by profession is much more proficient with LV
than I am gave me the solution, and here it is:
VI A the caller should have two While loops, with a "WAit"
function of say 100ms; one loop is in charge of continuously
displaying global variable V on the indicator, the other of
calling VI B.
VI B itself consists of a while loop where a command feeds
and modifies global variable V. B is modal and centered, so
it won't hide the indicator on A.
This indicator is correctly updated on A when V is modified
on B.
There is a problem, though: in VI A, the two loops cannot be
exited under the action of an "armed" button (VI won't
compile). One must use a simpler button type.
One things to be noted is that *this architecture works even
with multithreading disabled in LV!!!*.
Why this works at al is beyond me, but I would appreciate
explanations however.
For now I can go back to programming my stuff the way I like
(well, the way the client said it should be programmed 8-)
Many thanks to the two persons that tried to help me.