Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jan 1998 10:19:34 -0800 (PST)
From:      Doug White <dwhite@gdi.uoregon.edu>
To:        Robert Watson <robert@cyrus.watson.org>
Cc:        questions@FreeBSD.ORG
Subject:   Re: pthreads implementation in 3.0
Message-ID:  <Pine.BSF.3.96.980127100803.16462F-100000@gdi.uoregon.edu>
In-Reply-To: <Pine.BSF.3.96.980122163522.5088d-100000@cyrus.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
I saw this pop up on hackers and wanted to add my own reactions.

On Thu, 22 Jan 1998, Robert Watson wrote:

> 1. Is there a thread-safe fork (as found in the Solaris pthreads fork() or
> lwp fork1()) that only copies the current thread (not the current process
> and all of its threads). 

Checking my threads programming book, FreeBSD follows the UNIX
International convention, but we don't have fork1(). :-)  You might be
able to get around this by using vfork(), as long as the *first* thing you
do after the vfork() is exec() or execve() or whatever.  If you modify
memory in any way bad before the exec() bad things happen.

Doug White                              | University of Oregon  
Internet:  dwhite@resnet.uoregon.edu    | Residence Networking Assistant
http://gladstone.uoregon.edu/~dwhite    | Computer Science Major

PS:  "Programming with Threads" by Steve Kleiman et. al. (ISBN
0-13-172389-8) is a good general reference for pthreads and Solaris
threads.  The book assumes a Solaris development environment and
FreeBSD pthreads has it's own tweaks and not-yet-implementeds but is
decent enough to get started. It addresses many threads programming issues
such as synchronization and fork() strategies.





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