From owner-freebsd-hackers Sat Jan 30 09:04:19 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA11434 for freebsd-hackers-outgoing; Sat, 30 Jan 1999 09:04:19 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from fledge.watson.org (FLEDGE.RES.CMU.EDU [128.2.93.229]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA11429 for ; Sat, 30 Jan 1999 09:04:17 -0800 (PST) (envelope-from robert@cyrus.watson.org) Received: from fledge.watson.org (robert@fledge.pr.watson.org [192.0.2.3]) by fledge.watson.org (8.8.8/8.8.8) with SMTP id MAA01347 for ; Sat, 30 Jan 1999 12:04:15 -0500 (EST) Date: Sat, 30 Jan 1999 12:04:15 -0500 (EST) From: Robert Watson X-Sender: robert@fledge.watson.org Reply-To: Robert Watson To: freebsd-hackers@FreeBSD.ORG Subject: Correct way to write a thread-safe library Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG So here I am, chugging away at a library I'm writing, and I notice that the spec requires me to report errors via errno. I immediatly recall a long discussion of errno changes a long time ago and macro definitions of it. So my question is this--what is the correct way for me to write a thread-safe library that can be used by threaded and non-threaded code, and that also uses errno to report errors? Is there a way? Do I just use it or should I be having two versions of my library, a libwhatever and a libwhatever_r? Thanks in advance.. Robert N Watson robert@fledge.watson.org http://www.watson.org/~robert/ PGP key fingerprint: 03 01 DD 8E 15 67 48 73 25 6D 10 FC EC 68 C1 1C Carnegie Mellon University http://www.cmu.edu/ TIS Labs at Network Associates, Inc. http://www.tis.com/ SafePort Network Services http://www.safeport.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message