[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: Correct way to write a thread-safe library
From:       John Birrell  <jb () cimlogic ! com ! au>
Date:       1999-01-31 20:36:14
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic