Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Feb 2000 13:22:44 -0600
From:      Dan Nelson <dnelson@emsphone.com>
To:        Alfred Perlstein <bright@wintelcom.net>
Cc:        Spidey <beaupran@iro.umontreal.ca>, Freebsd Questions Mailing list <freebsd-questions@FreeBSD.ORG>
Subject:   Re: PThreads
Message-ID:  <20000207132244.A81581@dan.emsphone.com>
In-Reply-To: <20000207101438.Y25520@fw.wintelcom.net>; from "Alfred Perlstein" on Mon Feb  7 10:14:38 GMT 2000
References:  <14494.21789.847287.358066@anarcat.dyndns.org> <20000207101438.Y25520@fw.wintelcom.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Feb 07), Alfred Perlstein said:
> * Spidey <beaupran@iro.umontreal.ca> [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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000207132244.A81581>