public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* condvar.c
@ 1999-05-26  9:20 Peter Slacik
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Slacik @ 1999-05-26  9:20 UTC (permalink / raw)
  To: Pthreads-Win32 Mailing List

Hi thread writers,

I tried to upgrade (after half year) to the current pthreads snapshot,
snap-1999-04-07, and I suspect one inequality test to be wrong:

cvs diff -c -r1.1 -r1.2 condvar.c
Index: condvar.c
===================================================================
RCS file: pthread/condvar.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** condvar.c   1999/04/07 12:18:40     1.1
--- condvar.c   1999/05/26 16:10:08     1.2
***************
*** 851,857 ****
         * Wait for all the awakened threads to acquire their part of
         * the counting semaphore
         */
!       if (WaitForSingleObject (cv->waitersDone, INFINITE) !=
            WAIT_OBJECT_0)
          {
            result = 0;
--- 851,857 ----
         * Wait for all the awakened threads to acquire their part of
         * the counting semaphore
         */
!       if (WaitForSingleObject (cv->waitersDone, INFINITE) ==
            WAIT_OBJECT_0)
          {
            result = 0;

Please check this.

Regards
Peter Slacik



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

* Re: condvar.c
  1999-05-27  9:02 ` condvar.c Mark E. Armstrong
@ 1999-05-27 22:15   ` Ross Johnson
  0 siblings, 0 replies; 4+ messages in thread
From: Ross Johnson @ 1999-05-27 22:15 UTC (permalink / raw)
  To: Mark E. Armstrong
  Cc: Bossom, John, 'Peter Slacik', Pthreads-Win32 Mailing List

Hi all,

I'm going to put up a new snapshot late saturday (my time) with all
patches since snapshot 99-04-07 included.

Thanks everyone.
Ross

On Thu, 27 May 1999, Mark E. Armstrong wrote:

> Greetings,
> 
> After reading the referenced messages and checking the code WRT to
> the incorrect equality check, I noticed the assignment made to
> cv->wasBroadcast should be moved to prevent a possible memory
> fault when cv is dereferenced for auto-init objects:
> 
> 
> ************ original condvar.c starting at  line 828 ************
>   cv = *cond;
> 
>   cv->wasBroadcast = TRUE;
> 
>   /*
>    * No-op if the CV is static and hasn't been initialised yet.
>    */
>   if (cv == (pthread_cond_t) _PTHREAD_OBJECT_AUTO_INIT)
>     {
>       return 0;
>     }
> 
> ************* corrected condvar.c starting at  line 828 ************
>   cv = *cond;
> 
>   /*
>    * No-op if the CV is static and hasn't been initialised yet.
>    */
>   if (cv == (pthread_cond_t) _PTHREAD_OBJECT_AUTO_INIT)
>     {
>       return 0;
>     }
> 
>   cv->wasBroadcast = TRUE;
> 
> **********************************************************
> 
> Took a quick look through the rest of the 99-04-07 snapshot for similar
> errors and didn't find any more.
> 
> Enjoy,
> Mark Armstrong
> 
> 
> 
> 
> "Bossom, John" wrote:
> 
> > You are correct... (assuming the code snippet you sent originated from my
> > original source... it looks like it does... I don't have the win32-pthreads
> > snapshot).
> >
> > -----Original Message-----
> > From: Peter Slacik [ mailto:Peter.Slacik@tatramed.sk ]
> > Sent: Wednesday, May 26, 1999 12:19 PM
> > To: Pthreads-Win32 Mailing List
> > Subject: condvar.c
> >
> > Hi thread writers,
> >
> > I tried to upgrade (after half year) to the current pthreads snapshot,
> > snap-1999-04-07, and I suspect one inequality test to be wrong:
> >
> > cvs diff -c -r1.1 -r1.2 condvar.c
> > Index: condvar.c
> > ===================================================================
> > RCS file: pthread/condvar.c,v
> > retrieving revision 1.1
> > retrieving revision 1.2
> > diff -c -r1.1 -r1.2
> > *** condvar.c   1999/04/07 12:18:40     1.1
> > --- condvar.c   1999/05/26 16:10:08     1.2
> > ***************
> > *** 851,857 ****
> >          * Wait for all the awakened threads to acquire their part of
> >          * the counting semaphore
> >          */
> > !       if (WaitForSingleObject (cv->waitersDone, INFINITE) !=
> >             WAIT_OBJECT_0)
> >           {
> >             result = 0;
> > --- 851,857 ----
> >          * Wait for all the awakened threads to acquire their part of
> >          * the counting semaphore
> >          */
> > !       if (WaitForSingleObject (cv->waitersDone, INFINITE) ==
> >             WAIT_OBJECT_0)
> >           {
> >             result = 0;
> >
> > Please check this.
> >
> > Regards
> > Peter Slacik
> 
> 

+----------------------+---+
| Ross Johnson         |   | E-Mail: rpj@ise.canberra.edu.au
| Info Sciences and Eng|___|
| University of Canberra   | FAX:    +61 6 2015227
| PO Box 1                 |
| Belconnen  ACT    2616   | WWW:    http://willow.canberra.edu.au/~rpj/
| AUSTRALIA                |
+--------------------------+


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

* Re: condvar.c
  1999-05-26 10:17 condvar.c Bossom, John
@ 1999-05-27  9:02 ` Mark E. Armstrong
  1999-05-27 22:15   ` condvar.c Ross Johnson
  0 siblings, 1 reply; 4+ messages in thread
From: Mark E. Armstrong @ 1999-05-27  9:02 UTC (permalink / raw)
  To: Bossom, John; +Cc: 'Peter Slacik', Pthreads-Win32 Mailing List

Greetings,

After reading the referenced messages and checking the code WRT to
the incorrect equality check, I noticed the assignment made to
cv->wasBroadcast should be moved to prevent a possible memory
fault when cv is dereferenced for auto-init objects:


************ original condvar.c starting at  line 828 ************
  cv = *cond;

  cv->wasBroadcast = TRUE;

  /*
   * No-op if the CV is static and hasn't been initialised yet.
   */
  if (cv == (pthread_cond_t) _PTHREAD_OBJECT_AUTO_INIT)
    {
      return 0;
    }

************* corrected condvar.c starting at  line 828 ************
  cv = *cond;

  /*
   * No-op if the CV is static and hasn't been initialised yet.
   */
  if (cv == (pthread_cond_t) _PTHREAD_OBJECT_AUTO_INIT)
    {
      return 0;
    }

  cv->wasBroadcast = TRUE;

**********************************************************

Took a quick look through the rest of the 99-04-07 snapshot for similar
errors and didn't find any more.

Enjoy,
Mark Armstrong




"Bossom, John" wrote:

> You are correct... (assuming the code snippet you sent originated from my
> original source... it looks like it does... I don't have the win32-pthreads
> snapshot).
>
> -----Original Message-----
> From: Peter Slacik [ mailto:Peter.Slacik@tatramed.sk ]
> Sent: Wednesday, May 26, 1999 12:19 PM
> To: Pthreads-Win32 Mailing List
> Subject: condvar.c
>
> Hi thread writers,
>
> I tried to upgrade (after half year) to the current pthreads snapshot,
> snap-1999-04-07, and I suspect one inequality test to be wrong:
>
> cvs diff -c -r1.1 -r1.2 condvar.c
> Index: condvar.c
> ===================================================================
> RCS file: pthread/condvar.c,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -c -r1.1 -r1.2
> *** condvar.c   1999/04/07 12:18:40     1.1
> --- condvar.c   1999/05/26 16:10:08     1.2
> ***************
> *** 851,857 ****
>          * Wait for all the awakened threads to acquire their part of
>          * the counting semaphore
>          */
> !       if (WaitForSingleObject (cv->waitersDone, INFINITE) !=
>             WAIT_OBJECT_0)
>           {
>             result = 0;
> --- 851,857 ----
>          * Wait for all the awakened threads to acquire their part of
>          * the counting semaphore
>          */
> !       if (WaitForSingleObject (cv->waitersDone, INFINITE) ==
>             WAIT_OBJECT_0)
>           {
>             result = 0;
>
> Please check this.
>
> Regards
> Peter Slacik

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

* RE: condvar.c
@ 1999-05-26 10:17 Bossom, John
  1999-05-27  9:02 ` condvar.c Mark E. Armstrong
  0 siblings, 1 reply; 4+ messages in thread
From: Bossom, John @ 1999-05-26 10:17 UTC (permalink / raw)
  To: 'Peter Slacik', Pthreads-Win32 Mailing List

You are correct... (assuming the code snippet you sent originated from my
original source... it looks like it does... I don't have the win32-pthreads
snapshot).

-----Original Message-----
From: Peter Slacik [ mailto:Peter.Slacik@tatramed.sk ]
Sent: Wednesday, May 26, 1999 12:19 PM
To: Pthreads-Win32 Mailing List
Subject: condvar.c


Hi thread writers,

I tried to upgrade (after half year) to the current pthreads snapshot,
snap-1999-04-07, and I suspect one inequality test to be wrong:

cvs diff -c -r1.1 -r1.2 condvar.c
Index: condvar.c
===================================================================
RCS file: pthread/condvar.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** condvar.c   1999/04/07 12:18:40     1.1
--- condvar.c   1999/05/26 16:10:08     1.2
***************
*** 851,857 ****
         * Wait for all the awakened threads to acquire their part of
         * the counting semaphore
         */
!       if (WaitForSingleObject (cv->waitersDone, INFINITE) !=
            WAIT_OBJECT_0)
          {
            result = 0;
--- 851,857 ----
         * Wait for all the awakened threads to acquire their part of
         * the counting semaphore
         */
!       if (WaitForSingleObject (cv->waitersDone, INFINITE) ==
            WAIT_OBJECT_0)
          {
            result = 0;

Please check this.

Regards
Peter Slacik


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

end of thread, other threads:[~1999-05-27 22:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-26  9:20 condvar.c Peter Slacik
1999-05-26 10:17 condvar.c Bossom, John
1999-05-27  9:02 ` condvar.c Mark E. Armstrong
1999-05-27 22:15   ` condvar.c Ross Johnson

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).