Architecture to post and send messages to queues



Hi Folks,



I'm creating a VI that has multiple "threads," each of which must
respond to messages either sent internally, or from a parallel thread.
To do this, I have parallel loops (they're actually in separate VIs
now, but initially they were all in the same) each of which has a
message queue: just a standard queue of my own message datatype. Per
typical LabVIEW design, the messages are removed, a case of a case
structure is selected, and the appropriate code executed. A skeleton of
this is attached for reference.



This is all working fine and dandy, but I have discovered that I need
to not only post messages (enqueue the message and forget about it),
but some of the message need to be sent (post the message and wait for
a response from the receiving thread).



I'm obviously trying to duplicate the PostMessage and SendMessage
behavior found in Windows, but it's a bit easier in C because the
WindowProc can be called from any thread. With PostMessage it's called
from the message pump thread, with SendMessage, it's called from the
calling thread. Since I don't really have the equivalent to a
WindowProc, I don't have that option. (As I'm typing this, I realize
that perhaps I should create a VI for each loop that is the equivalent
to WindowProc. I'll have to think about that.)



I've toyed with the idea of using a notifier associated with each queue
for the responses, or even a second queue, but I haven't quite come up
with a really robust way to enable this.



So, the questions are: Have any of you done this? How did you do it?



Thanks,

Jason
.