Date: Sat, 8 Aug 1998 07:35:32 +1000 (EST) From: John Birrell <jb@cimlogic.com.au> To: archie@whistle.com (Archie Cobbs) Cc: jb@cimlogic.com.au, archie@whistle.com, freebsd-current@FreeBSD.ORG, bde@zeta.org.au, wollman@khavrinen.lcs.mit.edu, dg@root.com Subject: Re: memory leaks in libc Message-ID: <199808072135.HAA10923@cimlogic.com.au> In-Reply-To: <199808071703.KAA29656@bubba.whistle.com> from Archie Cobbs at "Aug 7, 98 10:03:20 am"
next in thread | previous in thread | raw e-mail | index | archive | help
Archie Cobbs wrote: > Well, setenv() and unsetenv() are not thread safe as they > currently exist. How does this look? FWIW, I think that any proposed changes to libc should be _required_ to be thread-safe from now on so that libc has a better chance of working with kernel threads. > +void > +__env_lock(void) > +{ > + THREAD_LOCK(); > +} > + > +/* > + * __env_unlock() > + * > + * Release mutex lock on the environment. Should be static. > + */ > +void > +__env_unlock(void) > +{ > + THREAD_UNLOCK(); > +} Why add these functions? Since kernel threads require the standard libc to be thread safe, don't expect that the calls will be optimized out. The idea is to make the non-threaded runtime impact just a test on the __is_threaded variable. Using the THREAD_LOCK() and THREAD_UNLOCK() macros directly will achieve this. -- John Birrell - jb@cimlogic.com.au; jb@freebsd.org http://www.cimlogic.com.au/ CIMlogic Pty Ltd, GPO Box 117A, Melbourne Vic 3001, Australia +61 418 353 137 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808072135.HAA10923>