|
Boost Users : |
Subject: Re: [Boost-users] [thread] Is Boost suitable for this application?
From: Jerry (jerry.jeremiah_at_[hidden])
Date: 2010-06-06 20:22:07
Francisco Javier Porras Gálvez <francisco.porras.78 <at> hotmail.com> writes:
>
>
> Hi, all.
> Â
> I don't know anything about Boost, neither OpenMP,
> pthread nor Windows API thread library. So, before begin learning one of
> these, I'd like to explain to you how I want my application to work.
> Â
> It deals with running two parallel loops, one in LabView, and the other in
> C++. It doesn't matter if you don't know anything about LabView, this
> explanation is easy enough to understand. Attached you can see a picture
> which shows the desired execution behaviour. I want to know whether my
> application would be possible to achieve using Boost, or using another
> API. In another general C++ forum, I was suggested to use Boost.
> Â
> First, the execution begins in LabView. Here, I call a dll function written
> in C++. This is the "initialization" function. Its aim is to create another
> thread that will execute the main loop in C++. Then, this "initialization"
> function ends, because it has to return the control execution to LabView,
> but the new thread which has just been created must continue executing in
> its own loop.
> Â
> Now we have two loops in parallel: LabView and C++. In LabView's loop, we
> call periodically another dll function that has to send and retrieve data
> from the independent thread in C++. This function, like the other, has to
> end executing to pass control to LabView again, after it has done its
> purpose.
> Â
> This will be the behaviour until we call from LabView another dll function
> to stop the independent thread (not shown in the picture). After this, the
> LabView program ends.
> Â
> Is it possible to use Boost for this? If so, could
> you post a brief example about how you'd make it?
> Â
> Thanks in advance,Francisco
I did something almost exactly like this about 10 years ago with LabView 7. I
made a DLL that created a thread that started a socket listner so that other
computers could connect to the embedded Labview to get control data.
Now, Labview allows you to create sockets, but the protocol library for the
socket data was already in C++ and I tried to create the socket in Labview and
pass it into the DLL but I had quite a bit of trouble. It didn't work
correctly in Labview 7. I raised a ticket with NI and they basically couldn't
help me because none of their help desk knew anything about making your own
DLL. Hopefully the support is better now.
So anyway, I created a DLL that started a thread and created a socket
listner. Then periodically I would call another function in the DLL to
deposit control data that the socket listener could send to requestors. I had
it start a separate thread because I was using a blocking socket listener.
It all works fine. And from Labview's point of view it doesn't matter what
library you use to create the socket because all that is hidden in the DLL. I
used Visual Studio's C runtime beginthread function and that worked because
the embedded Labview system was running on Windows, but of course it isn't
portable (neither is pthread or Windows API threads). Boost Threads is
portable and would work fine.
Do you know what OS your Labview app will be running on?
Jerry
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net