Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7128575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:09:10+00:00 2026-05-28T11:09:10+00:00

I am using popen to start a C++ slave program from a master program.

  • 0

I am using popen to start a C++ slave program from a master program. However, by doing so control does not return to the master program until the slave has completed its tasks.

How can I start the slave in a separate session (or separate thread), so the master is not forced to wait for it to finish before control is passed back to the master?

I would like the master to be able to start the slave and then finish, with the slave continuing after the master has exited.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T11:09:10+00:00Added an answer on May 28, 2026 at 11:09 am

    To do this you need to fork the main process and then check the pid_t that the fork command returns. From there you can then do an exec or popen as you please.

    When you call fork the calling process gets a pid_t returned (this is the id of the child process you just created). If the pid_t is 0 then this is the newly created process and you can do as you please.

    e.g.

    pid_t childPid  = fork();
    if( childPid == 0 )
    {
        // Do your process create here.
        ...
    
        // Abort this process once it returns control.
        abort(); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a python program that lauches a subprocess (using Popen). I am
I would like to run a process from Python (2.4/2.5/2.6) using Popen , and
I want to make some C++ program and I'm using function popen here to
I'm using popen to read output from shell commands. I will use fgets to
I create a subprocess using subprocess.Popen() that runs for a long time. It is
I'm currently launching a programme using subprocess.Popen(cmd, shell=TRUE) I'm fairly new to Python, but
How can I run the following command using subprocess.Popen ? mysqldump database_name table_name |
I'm having a very strange issue with Python's subprocess.Popen. I'm using it to call
Using online interfaces to a version control system is a nice way to have
I'm writing a python script that uses subprocess.Popen to execute two programs (from compiled

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.