Thread: C++ pipelining

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    6

    C++ pipelining

    Is it possible to connect two running applications using pipelines, similar to how Perl uses them?

    Otherwise, how else could I implement a seperate UI program?

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    There are several forms of inter-process communication (IPC) available in C++. Pipes are one option.

    Note that separate processes isn't always the best solution, you might also want to consider just using separate threads in the same process.

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    6
    How could I use seperate threads?

    The program would be halted whist waiting for input from the user, but at the same time, the program needs to monitor other stuff.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Thats what threads do. One thread waits for user input while another does work in the background. You can have several threads if you have several different things to do, and there doesn't necessarily have to be one for UI.

    To use them you will probably want to do some research on how they work. Which thread API you use depends on your platform, although Boost's thread library might be a good choice regardless.

  5. #5
    Registered User
    Join Date
    Jan 2007
    Posts
    6
    Thanks Daved. Do you have any links to online tutorials, or something? I've tried a google search for some of the terms that you've written, but with no results.

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Actually I don't, sorry. You would go to boost.org to get the latest boost download if you want to use their threads library. They would have documentation there as well. I don't know of any good threads tutorials though. Perhaps someone else will be able to chime in on the subject. What OS and compiler/IDE are you using?

  7. #7
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    If you are using linux, there's a good tutorial about thread in YoLinux. Also you can google for POSIX thread.

    For windows, look at this tutorial. You might also have to learn about thread synchronization.
    ERROR: Brain not found. Please insert a new brain!

    “Do nothing which is of no use.” - Miyamoto Musashi.

  8. #8
    Registered User
    Join Date
    Jan 2007
    Posts
    6
    I'm using Borland CPP running on Windows XP.

    I originally wanted to have two processes (comand line applications) running parallel to each other, with one used for monitoring, and the other as user interface, where messages can be sent to the UI by the monitor and commands can be sent by the UI to the monitor.

    I might now use two Windows (just simple text "terminals") running on different threads, to give the appearance of two processes.

    At the moment though, IPC seems to be the best solution, but I can't find any document on that either. A simple google search for 'C++ pipeline' returns nothing at all.

  9. #9
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Try C++ IPC or C++ pipes, not pipeline.

  10. #10
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    if you do decide to use boost.threads (and I'd recommend them), there's a good tutorial on the subject here. It's pretty basic, but it should get you started.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pipelining threads
    By pari in forum C Programming
    Replies: 5
    Last Post: 11-21-2003, 01:51 PM