This is the mail archive of the pthreads-win32@sourceware.org mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

pthread_cond_destroy bug



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]