Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Feb 1999 07:36:14 +1100 (EST)
From:      John Birrell  <jb@cimlogic.com.au>
To:        jdp@polstra.com (John Polstra)
Cc:        robert+freebsd@cyrus.watson.org, hackers@FreeBSD.ORG
Subject:   Re: Correct way to write a thread-safe library
Message-ID:  <199901312036.HAA03095@cimlogic.com.au>
In-Reply-To: <199901311837.KAA07195@vashon.polstra.com> from John Polstra at "Jan 31, 1999 10:37:10 am"

next in thread | previous in thread | raw e-mail | index | archive | help
John Polstra wrote:
> and then make "__error()" return a pointer to where the possibly
> thread-specific value is stored.  You can look at our existing libc
> and libc_r code for an example.
> 
> The C standard explicitly allows for this by requiring "errno" to be
> an lvalue but not necessarily a simple variable.  It also requires
> compilation units that reference "errno" to include <errno.h>.

Sorry I missed the original mail. I think the question was about writing
a library that _uses_ errno rather than one that implements it. From
3.0-RELEASE on, FreeBSD's errno definition in <errno.h> is thread aware,
so there is no need to do anything in third-party libraries other
than to code:

errno = Esomething;

-- 
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-hackers" in the body of the message



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