Date: Wed, 13 Jan 1999 17:31:45 -0800 (PST) From: Mike Meyer <mwm@phone.net> To: "'freebsd-questions@FreeBSD.ORG'" <freebsd-questions@FreeBSD.ORG> Subject: Re: reentrant code Message-ID: <Pine.BSF.4.05.9901131724550.4281-100000@guru.phone.net> In-Reply-To: <Pine.BSF.4.05.9901132000290.356-100000@nyc-ny66-33.ix.netcom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Personally, I always thought I had a good grip on what re-entrant meant and what "thread-safe" means. If I correctly understand those, then thread-safe functions should all be reentrant (pretty much required, isn't it?). In which case: On Wed, 13 Jan 1999, Spike Gronim wrote: > According to _Advanced Programming in the Unix Environment_, a reentrant > function must not call malloc(), free(), a function from the standard I/O > library, or a function which uses a static data structure of which there > is only one available to the process. Malloc, free and the standard i/o library are in libc. From 'man pthread': The current FreeBSD POSIX thread implementation is built in the library libc_r which contains both thread-safe libc functions and the thread functions. This library replaces libc for threaded applications. So, by linking with libc_r instead of libc, you should be able to use those routines in functions and have them remain reentrant. These may well be overkill. If that isn't the case, I'd be interested in knowing the technical details of how a thread-safe routine can be non-reentrant. Thanx, <mike 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?Pine.BSF.4.05.9901131724550.4281-100000>