(file) Return to Semaphore.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/Semaphore.cpp between version 1.4 and 1.5

version 1.4, 2006/08/21 08:48:20 version 1.5, 2006/08/21 15:31:03
Line 35 
Line 35 
 #include <Pegasus/Common/IPCExceptions.h> #include <Pegasus/Common/IPCExceptions.h>
 #include "Semaphore.h" #include "Semaphore.h"
  
 PEGASUS_NAMESPACE_BEGIN  PEGASUS_NAMESPACE_BEGIN static const Uint32 PEGASUS_SEM_VALUE_MAX = 0x0000ffff;
   
 static const Uint32 PEGASUS_SEM_VALUE_MAX = 0x0000ffff;  
  
 //============================================================================== //==============================================================================
 // //
Line 66 
Line 64 
 #ifndef PEGASUS_PLATFORM_AIX_RS_IBMCXX #ifndef PEGASUS_PLATFORM_AIX_RS_IBMCXX
    pthread_mutex_lock(&_rep.mutex);    pthread_mutex_lock(&_rep.mutex);
    int r=0;    int r=0;
    while( r=pthread_cond_destroy(&_rep.cond) == EBUSY || (r==-1 && errno == EBUSY) )      while ((r = pthread_cond_destroy(&_rep.cond) == EBUSY) ||
              (r == -1 && errno == EBUSY))
    {    {
       pthread_mutex_unlock(&_rep.mutex);       pthread_mutex_unlock(&_rep.mutex);
       Threads::yield();       Threads::yield();
Line 77 
Line 76 
 #else #else
    int val;    int val;
    val = pthread_mutex_destroy(&_rep.mutex);    val = pthread_mutex_destroy(&_rep.mutex);
   
    if (val != 0)    if (val != 0)
       pthread_cond_destroy(&_rep.cond);       pthread_cond_destroy(&_rep.cond);
    else    else
Line 134 
Line 134 
    _count--;    _count--;
  
     // Since we push an unlock onto the cleanup stack     // Since we push an unlock onto the cleanup stack
    // We will pop it off to release the mutex when leaving the critical section.      // We will pop it off to release the mutex when leaving the critical
       // section.
 #if defined(PEGASUS_PLATFORM_AIX_RS_IBMCXX) #if defined(PEGASUS_PLATFORM_AIX_RS_IBMCXX)
    Threads::cleanup_pop(1);    Threads::cleanup_pop(1);
 #endif #endif
Line 174 
Line 175 
  
    while ((_count == 0) && !timedOut)    while ((_count == 0) && !timedOut)
    {    {
       int r = pthread_cond_timedwait(          int r = pthread_cond_timedwait(&_rep.cond, &_rep.mutex, &waittime);
          &_rep.cond, &_rep.mutex, &waittime);  
  
       if (((r == -1 && errno == ETIMEDOUT) || (r == ETIMEDOUT)) && _count == 0)          if (((r == -1 && errno == ETIMEDOUT) || (r == ETIMEDOUT)) &&
               _count == 0)
       {       {
          timedOut = true;          timedOut = true;
       }       }
Line 194 
Line 195 
  
 #if defined(PEGASUS_PLATFORM_AIX_RS_IBMCXX) #if defined(PEGASUS_PLATFORM_AIX_RS_IBMCXX)
    // Since we push an unlock onto the cleanup stack    // Since we push an unlock onto the cleanup stack
    // We will pop it off to release the mutex when leaving the critical section.      // We will pop it off to release the mutex when leaving the critical
       // section.
    Threads::cleanup_pop(1);    Threads::cleanup_pop(1);
 #endif #endif
  
Line 270 
Line 272 
             if (ignoreInterrupt == false)             if (ignoreInterrupt == false)
                 throw(WaitInterrupted(_rep.owner));                 throw(WaitInterrupted(_rep.owner));
         }         }
         else throw(WaitFailed(_rep.owner));          else
               throw(WaitFailed(_rep.owner));
  
         // keep going if above conditions fail         // keep going if above conditions fail
     } while (true);      }
       while (true);
  
 } }
  
Line 315 
Line 319 
       do       do
       {       {
          retcode = sem_trywait(&_rep.sem);          retcode = sem_trywait(&_rep.sem);
       } while (retcode == -1 && errno == EINTR);          }
           while (retcode == -1 && errno == EINTR);
  
       if ( retcode == 0 )       if ( retcode == 0 )
          return ;          return ;


Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2