public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
From: Eric Berge <eric.berge@quantum.com>
To: pthreads-win32@sourceware.org
Subject: pthread_cond_destroy bug
Date: Mon, 18 Sep 2006 16:57:00 -0000	[thread overview]
Message-ID: <450ECFD2.4040804@quantum.com> (raw)


I was running a tool recently that flagged some missing
LeaveCriticalSection() calls in pthread_cond_destroy().
These are the following two return calls after entering
the critical section:

  if (*cond != PTHREAD_COND_INITIALIZER)
     {
       EnterCriticalSection (&ptw32_cond_list_lock);

       cv = *cond;

       /*
        * Close the gate; this will synchronize this thread with
        * all already signaled waiters to let them retract their
        * waiter status - SEE NOTE 1 ABOVE!!!
        */
       if (sem_wait (&(cv->semBlockLock)) != 0)
         {
           return errno;
         }

       /*
        * !TRY! lock mtxUnblockLock; try will detect busy condition
        * and will not cause a deadlock with respect to concurrent
        * signal/broadcast.
        */
       if ((result = pthread_mutex_trylock (&(cv->mtxUnblockLock))) != 0)
         {
           (void) sem_post (&(cv->semBlockLock));
           return result;
         }

I've fixed this in our local copy but thought I'd pass this along
for inclusion in the base code.

Thanks,

-- Eric

-- 
Eric Berge
Quantum Corp.
101 W. Burnsville Pkwy #200
Burnsville, MN 55337
eric.berge@quantum.com
612-747-3439

                 reply	other threads:[~2006-09-18 16:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=450ECFD2.4040804@quantum.com \
    --to=eric.berge@quantum.com \
    --cc=pthreads-win32@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).