public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Bug in pthread_equal
@ 2001-07-26  6:25 Pieter de Visser
  2001-07-26 13:47 ` Christopher Faylor
  0 siblings, 1 reply; 3+ messages in thread
From: Pieter de Visser @ 2001-07-26  6:25 UTC (permalink / raw)
  To: cygwin

There seems to be a bug in pthread_equal:

    int pthread_equal(pthread_t t1, pthread_t t2)

should return a non-zero value if t1 and t2 refer to the same thread, and a 
zero value otherwise. With the Cygwin DLL 1.3.2 implementation, it is the other 
way around: the function returns zero if t1 and t2 refer to the same thread, 
and a non-zero value otherwise.

One way to solve this would be to change
cygwin-1.3.2-1/winsup/cygwin/thread.cc, at line 1811: replace 

int
__pthread_equal (pthread_t * t1, pthread_t * t2)
{
  return (*t1 - *t2);
}

with

int
__pthread_equal (pthread_t * t1, pthread_t * t2)
{
  return (*t1 == *t2);
}

(I did not test this, though.)

Pieter

P.S. Please cc: any replies to me as I don't read this mailing list.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug in pthread_equal
  2001-07-26  6:25 Bug in pthread_equal Pieter de Visser
@ 2001-07-26 13:47 ` Christopher Faylor
  2001-07-26 16:53   ` Robert Collins
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Faylor @ 2001-07-26 13:47 UTC (permalink / raw)
  To: Pieter de Visser; +Cc: cygwin

On Thu, Jul 26, 2001 at 03:22:52PM +0200, Pieter de Visser wrote:
>There seems to be a bug in pthread_equal:
>
>    int pthread_equal(pthread_t t1, pthread_t t2)
>
>should return a non-zero value if t1 and t2 refer to the same thread, and a 
>zero value otherwise. With the Cygwin DLL 1.3.2 implementation, it is the other 
>way around: the function returns zero if t1 and t2 refer to the same thread, 
>and a non-zero value otherwise.
>
>One way to solve this would be to change
>cygwin-1.3.2-1/winsup/cygwin/thread.cc, at line 1811: replace 
>
>int
>__pthread_equal (pthread_t * t1, pthread_t * t2)
>{
>  return (*t1 - *t2);
>}
>
>with
>
>int
>__pthread_equal (pthread_t * t1, pthread_t * t2)
>{
>  return (*t1 == *t2);
>}

Looks right to me.  I've applied this change.

Thanks for tracking it down.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug in pthread_equal
  2001-07-26 13:47 ` Christopher Faylor
@ 2001-07-26 16:53   ` Robert Collins
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Collins @ 2001-07-26 16:53 UTC (permalink / raw)
  To: cygwin; +Cc: Pieter de Visser

On 26 Jul 2001 16:47:55 -0400, Christopher Faylor wrote:
> On Thu, Jul 26, 2001 at 03:22:52PM +0200, Pieter de Visser wrote:
> >There seems to be a bug in pthread_equal:
> >
> >    int pthread_equal(pthread_t t1, pthread_t t2)
> >

> Looks right to me.  I've applied this change.
> 
> Thanks for tracking it down.
> 
> cgf
> 
Doh! Thanks Chris, Pieter,

Rob


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-07-26 16:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-26  6:25 Bug in pthread_equal Pieter de Visser
2001-07-26 13:47 ` Christopher Faylor
2001-07-26 16:53   ` Robert Collins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).