Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Jun 2005 20:07:23 -0400 (EDT)
From:      Daniel Eischen <deischen@freebsd.org>
To:        Aziz Kezzou <french.linuxian@gmail.com>
Cc:        freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Re: Fork mystries....
Message-ID:  <Pine.GSO.4.43.0506032001410.927-100000@sea.ntplx.net>
In-Reply-To: <3727392705060316555071c4ad@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 3 Jun 2005, Aziz Kezzou wrote:

> Hi all,
> It's probably not the right mailing list to ask but I am really
> surprised about global variable sharing in a multithreaded C
> application. If I remember well my multithreading course global
> variables are shared between threads, right ?

Uhh, fork() creates a process, not a thread.  The child
is a _copy_ of the parent; they do not share address space.
See the man page for fork.  If you want really want threads,
use threads (see man page for pthread).

-- 
DE




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.43.0506032001410.927-100000>