Ticket #114: nondebug_mutex_errorcheck.diff

File nondebug_mutex_errorcheck.diff, 0.9 kB (added by slack, 16 years ago)
  • ./src/libutil/PosixMutex.cpp

    old new  
    5050    #ifdef DEBUG 
    5151        pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); 
    5252    #else 
    53         pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_DEFAULT); 
     53        pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); 
    5454    #endif 
    5555    pthread_mutex_init(&m_mutex, &attr); 
    5656    pthread_mutexattr_destroy(&attr); 
     
    8585        pthread_mutex_lock(&m_mutex); 
    8686    } 
    8787    #else 
    88     pthread_mutex_lock(&m_mutex); 
     88    if ( pthread_mutex_lock(&m_mutex) ) { 
     89        fprintf(stderr, "ERROR: pthread_mutex_lock() failed!!!\n"); 
     90    } 
    8991    #endif 
    9092} 
    9193 
     
    109111                this, unlocker); 
    110112    #endif 
    111113 
    112     pthread_mutex_unlock(&m_mutex); 
     114    if ( pthread_mutex_unlock(&m_mutex) ) { 
     115        fprintf(stderr, "ERROR: pthread_mutex_unlock() failed!!!\n"); 
     116    } 
    113117} 
    114118 
    115119void