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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:09:12+00:00 2026-06-02T14:09:12+00:00

In linux, the whole process exits when the main thread terminates no matter how

  • 0

In linux, the whole process exits when the main thread terminates no matter how it terminates,by the function exit() or returns from main. If the main thread returns from main(),it will return to the “C runtime” known as crt.o or something like that. In the crt.o,whose c code like this: exit(main(argc, argv)); exit() will be called by the main thread
eventually, as a result, all the threads terminate.

Does my thought seem right?

If in the crt.o exit() is replaced by a thread terminating function like void thread_exit(int),which can only terminates a thread with an exit status, the c source code of crt.o seems like thread_exit(main(argc,argv)),do other thread still run when the main thread terminates?

  • 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-06-02T14:09:14+00:00Added an answer on June 2, 2026 at 2:09 pm

    Returning from main is equivalent to calling exit, and terminates the process. To terminate just a single thread, use pthread_exit. Note that it’s valid for the initial thread to call pthread_exit (and the process does not terminate until all threads have exited or until one of them calls exit) and threads other than the initial thread implicitly call pthread_exit if you return from their start functions.

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

Sidebar

Related Questions

As I'm coding for both Windows and Linux, I have a whole host of
Linux bash script: function Print() { echo $1 } Print OK This script runs
Linux bash script: #!/bin/bash function Print() { echo $1 } var=* Print $var Execution
On Linux under X11 and using GTK+ you have something called Main Loop. Once
I'm here to ask you the difference between a process and a thread in
I have a process with permissions 4750. Two users exist in my Linux system.
I have encountered a problem of socket communication on linux system, the communication process
I'm trying to connect to an MSSQL database from python on Linux (SLES). I
I have a question about program exit state in Linux. In my program, I
I am debugging a process on a web server running Linux. The process is

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.