From owner-freebsd-hackers Tue Dec 12 2:29:11 2000 From owner-freebsd-hackers@FreeBSD.ORG Tue Dec 12 02:29:09 2000 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id ACAB937B402 for ; Tue, 12 Dec 2000 02:29:09 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id eBCASWe04896; Tue, 12 Dec 2000 02:28:32 -0800 (PST) Date: Tue, 12 Dec 2000 02:28:32 -0800 From: Alfred Perlstein To: Satyajeet Seth Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Can kernel threads be implemented using rfork? Message-ID: <20001212022832.C16205@fw.wintelcom.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from sseth@sasken.com on Tue, Dec 12, 2000 at 03:51:10PM +0530 Sender: bright@fw.wintelcom.net Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Satyajeet Seth [001212 02:21] wrote: > Hi > > Is it possible to implement threads in FreeBSD 4.0 kernel using the rfork > system call? If yes, could you give an example? > > > I tried to get the following piece of code to work without success. > > #include > main() > { > if (rfork( RFPROC | RFNOWAIT | RFMEM | RFSIGSHARE ) > 0) > { > while(1) > printf ("Parent process's pid = %d\n", getpid()); > } > while(1) > printf ("Child process's pid = %d\n", getpid()); > } Use the linuxthreads port and you'll save yourself a lot of work. Btw, this question gets asked once or twice a week on this list, you should check the archives before posting to -hackers. -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message