From owner-freebsd-questions Mon Feb 7 11:22:21 2000 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by builder.freebsd.org (Postfix) with ESMTP id C62DD40CB for ; Mon, 7 Feb 2000 11:22:16 -0800 (PST) Received: (from dan@localhost) by dan.emsphone.com (8.9.3/8.9.3) id NAA81975; Mon, 7 Feb 2000 13:22:44 -0600 (CST) (envelope-from dan) Date: Mon, 7 Feb 2000 13:22:44 -0600 From: Dan Nelson To: Alfred Perlstein Cc: Spidey , Freebsd Questions Mailing list Subject: Re: PThreads Message-ID: <20000207132244.A81581@dan.emsphone.com> References: <14494.21789.847287.358066@anarcat.dyndns.org> <20000207101438.Y25520@fw.wintelcom.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <20000207101438.Y25520@fw.wintelcom.net>; from "Alfred Perlstein" on Mon Feb 7 10:14:38 GMT 2000 X-OS: FreeBSD 4.0-CURRENT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Feb 07), Alfred Perlstein said: > * Spidey [000206 21:43] wrote: > > Hi! > > > > I am currently working on a program that needs pthreads. > > > > Is there some bugs in FBSD implementation of the pthreads? Because > > I'm having serious problems here: > > yes, you can't possibly expect readdir() which returns a pointer to a > _static_ structure to be thread safe the way you are using it. > > if you wanted to fix this, then I would strdup() the d_name in the > main thread then pass it to the slave threads, (don't forget to > free() it!) You could also change your program to use readdir_r(), which is thread safe. -- Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message