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 166257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:03:58+00:00 2026-05-11T12:03:58+00:00

I have a block of code like this that runs as a child thread:

  • 0

I have a block of code like this that runs as a child thread:

if(someVar == 1){ doSomeStuff;  _exit(0) } else    execvp(*(temp->_arguments), temp->_arguments); printf('I'm done\n'); 

When I run the program with someVar == 1, I understand that the _exit(0) call kills my thread. However, when it’s set to 0, why doesn’t the program continue after the execvp() call and do the printf statement?

  • 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. 2026-05-11T12:03:59+00:00Added an answer on May 11, 2026 at 12:03 pm

    If you exec* (call any exec function from the exec family), then the code of a new program is loaded into your current process and execution continues with its main function and its stuff. On a successful execution of those functions, they will never return because your printf does not exist anymore in memory.

    I think you confuse exec* with the fork function. That will splice off a new child process which will run the same code as the parent.

    If what you want is to create a new thread, that shares data and the address space with the main thread, you should use the pthread_create function. A new process will not share data and you will have to communicate with the other process using other mechanisms, like pipes or shared memory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say that I have a block of code like this: keysPressed = new
If I have a block of code like this: def show @post = Post.find(params[:id])
I have a block of code like this: <Compile Include=Share\System\Master\Relative\RelativeList.aspx.designer.cs> <DependentUpon>RelativeList.aspx</DependentUpon> </Compile> <Compile Include=Share\System\Master\Status\StatusInfo.aspx.cs>
I have a block of code like this: def some_method begin do_some_stuff rescue WWW::Mechanize::ResponseCodeError
I have some code that looks like this: foreach(var obj in collection) { try
If you have some blocks of code that you would like to prevent execution
I have a block of code that serializes a type into a Html tag.
I have a block of code that works great in 32bit, and I'm trying
I have this block of code where when I hover (click for purposes of
I have a block of code that worked outside of a function, but not

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.