Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Nov 1997 12:32:54 +0000
From:      njs3@doc.ic.ac.uk (Niall Smart)
To:        Charles Mott <cmott@srv.net>, Niall Smart <njs3@doc.ic.ac.uk>
Cc:        hackers@freebsd.org
Subject:   Re: pthread_cond_timedwait returning wrong error?
Message-ID:  <E0xageF-0005pH-00@ash3.doc.ic.ac.uk>
In-Reply-To: Charles Mott <cmott@srv.net> "Re: pthread_cond_timedwait returning wrong error?" (Nov 25,  3:24pm)

next in thread | previous in thread | raw e-mail | index | archive | help
On Nov 25,  3:24pm, Charles Mott wrote:
} Subject: Re: pthread_cond_timedwait returning wrong error?
> On Tue, 25 Nov 1997, Niall Smart wrote:
> > On Nov 25, 12:24pm, Charles Mott wrote:
> > } Subject: Re: pthread_cond_timedwait returning wrong error?
> > > 
> > > To me, having all the *_r reentrant functions is a big nuisance.
> > 
> > Yeah, lets invent our own standard!  Or maybe we should just leave out
> > threads altogether and stick with badly designed interfaces!
> > 
> I quess I was referring to the *_r functions on Solaris that I don't see
> anywhere else.  Are these standard?

Yes, to the POSIX pthreads standard. 

> I think having the standard Unix
> function calls with hidden thread addaptations like the errno solution
> (mapping errno to a function) explained by Alex Nash seems like a good
> idea to me. 

I think this is a kludge, although it is compliant with the POSIX API and
the best option given the circumstances.  WindowsNT uses GetLastError()
or somesuch, I would prefer to see something like this.  (of course, in
libc_r errno does expand to a function call, I just don't think its good
to have this ``hidden'' expansion)

Also, it is not practical to fix all broken interfaces in this way,
consider getpwent(), to make the existing interface thread safe it would
have to use thread specific data internally.  This overcomplicates its
implementation, a better way is to make the thread provide the thread
specific data (e.g.  from a buffer on the stack)  If every interface
in libc_r that used static data was converted to use thread specific
data its complexity, and therefore the number of bugs, would rise
substantically

> What I have observed from Solaris, FreeBSD, Linux and OSF is that there
> doesn't seem to be any standard that is obvious to me.  Even OSF 3.2 and
> 4.0 are different from each other.  This is a major source of annoyance if
> one is trying to develop software which will cleanly compile accross
> different platforms. 

This is probably due to the various operating systems implementing
different drafts of the POSIX standard, hopefully in the next releases
of the OS' incompatabilities will not be an issue. (yeah right!) :)

Regards,


Niall



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E0xageF-0005pH-00>