[PATCH] pthread_equal

Robert Collins rbcollins@cygwin.com
Thu Mar 20 08:15:00 GMT 2003


On Thu, 2003-03-20 at 18:28, Thomas Pfaff wrote:
> On Wed, 19 Mar 2003, Robert Collins wrote:
> 
> > On Thu, 2003-03-20 at 00:54, Thomas Pfaff wrote:
> > > 2003-03-19  Thomas Pfaff  <tpfaff@gmx.net>
> > >
> > > 	* pthread.cc (pthread_equal): Replacement for pthread_equal in
> > > 	thread.cc.
> > > 	* thread.cc: Rename pthread_equal to pthread::equal throughout.
> > > 	(pthread_equal): Remove.
> > > 	* thread.h (pthread::equal): New static method.
> >
> > This seems mostly pointless to me.
> >
> > A few notes:
> >
> > Why use a static method? you'll always have one pthread to compare to ,
> > so using operator == is appropriate. In fact, operator == already does
> > the right thing as it is the entire contents of pthread_equal.
> >
> > So: where pthread_equal is used internally, you could switch to (for
> > instance)
> > ==
> >  if (&thread == joiner)
> > ==
> 
> The only reason for this patch is to give the compiler the opportunity to
> do some inline optimizations. Without it it will always issue a function
> call only to test for equality of two pointers.

Huh? Not if you use the operator == syntax it won't. The synthetic
operator == is always inlined.

Rob

-- 
GPG key available at: <http://users.bigpond.net.au/robertc/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20030320/a0758f2d/attachment.sig>


More information about the Cygwin-patches mailing list