Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #1088

Re: String multithreading issue

Newsgroups comp.programming.threads
From Geoff Clare <geoff@clare.See-My-Signature.invalid>
Subject Re: String multithreading issue
References <0992cd7c-02bf-47e6-8c88-a171b7de8408@googlegroups.com> <k3fedn$6kd$1@mx1.internetia.pl> <505c048c$0$6575$9b4e6d93@newsspool3.arcor-online.net>
Date 2012-09-21 13:42 +0100
Message-ID <tt3ui9-1en.ln1@leafnode-msgid.gclare.org.uk> (permalink)
Organization Zen Internet

Show all headers | View raw


Marcel Müller wrote:

> On 20.09.2012 17:53, bartek szurgot wrote:
>> you do not join your threads, so you have a race - if threads will not
>> end before program exits, you have a problem.
>
> Does pthreads kill the process, if the main thread ends?
> Or is this just undefined behavior?

Returning from the initial call to main() is equivalent to calling
exit().  (The process is not killed; it terminates normally. Well,
"normally" as far as its parent can tell. I don't mean to imply that
exiting while other threads are running is a normal thing to do.)

You can call pthread_exit() instead of returning from main(), and
then the process will continue running until all of the other
threads have terminated.

-- 
Geoff Clare <netnews@gclare.org.uk>

Back to comp.programming.threads | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

String multithreading issue itt ium <ittium@gmail.com> - 2012-09-20 00:50 -0700
  Re: String multithreading issue Marcel Müller <news.5.maazl@spamgourmet.com> - 2012-09-20 11:54 +0200
  Re: String multithreading issue bartek szurgot <basz@no.spam> - 2012-09-20 17:53 +0200
    Re: String multithreading issue Marcel Müller <news.5.maazl@spamgourmet.com> - 2012-09-21 08:09 +0200
      Re: String multithreading issue Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2012-09-21 13:42 +0100
  Re: String multithreading issue Marc <marc.glisse@gmail.com> - 2012-09-20 16:37 +0000

csiph-web