123454353 :
Yes. It is easy.
To explain-
Notifiers are operating system level "named kernel objects". You can
obtain another reference to an existing named kernel object even from
another VI in another thread or for that matter even from another
executable not even written in LabVIEW with it's own memory space.
This is by design. Notifiers are intended to be used for
inter-process communications.
As a practical matter you just need to use "obtain notifier" again in
Vi2 with the same name that you used in Vi1. If the notifier already
exists because it was already created by Vi1, the obtain notifier in
Vi2 will return another reference to the existing notifier. If it
does not already exist, Vi2 will create the notifier and return a
reference to it.
DON'T STORE THE NOTIFIER REFERENCE IN A GLOBAL AND PASS IT FROM VI TO
VI. This is BAD!! You can have some very strange things happen if
you use a global to pass notifier references around. Instead ALWAYS
use "obtain notifier" to get another reference to the notifier.
Also remember to close every notifier reference you open and have some
clean up code that executes after everything else to destroy all
notifier references in case something happens and you forget to close
a reference you opened (e.g. because a VI dies before it closes a
notifier reference.)
Then in Vi2 you can wire that reference into your wait for notifier vi
so that it can wait on the notifier being sent from Vi1.
In fact, with notifiers you can have multiple Vi's all waiting on the
same notifier signal from Vi1. You could have Vi's Vi2,Vi3,..Vin all
waiting on the same notifier from Vi1. You can use this method to
broadcast a piece of data from a single vi to many waiting client
vi's. This may be useful in the following scenario:
You have a piece of hardware that can only be used by one caller at a
time. You can have a Vi1 continuously reading this hardware and
posting results into a notifier and then looping to read again.
Multiple client Vis (Vi2..Vin) could then wait for in a "blocked" (0%
CPU) state and use the notifier actual data for their own individual
needs.
Remember notifiers are like queues in that have a data type associated
with them rather than like occurrences which are just a signal only.
Unlike a queue however, a notifier doesn't keep a bunch of successive
frames of data and the data isn't "consumed" by the first
client-waiter vi that gets the data. Instead, it is replaced by the
server-setter.vi when the server posts the next frame of data to the
notifier. Thus if the client isn't ready for new data and the server
posts new data, the client-waiter will miss a frame of data.
The advantage though is that there can be multiple consumers of the
data.
A queue is more like a telephone call. A notifier is like a
commercial broadcating radio station.
Douglas De Clue
LabVIEW multithreading guru...
ddeclue@bellsouth.net
123454353 wrote in message news:<506500000008000000F2500000-1023576873000@exchange.ni.com>...
> I have two Vis and I use the "obtain notifier" and "send
> noitification" in my "Vi1". I want to be able to use a notifier
> reference in "Vi2" for my wait on notification without passing it as a
> parameter to "Vi2". Is this possible?