Changeset 1267

Show
Ignore:
Timestamp:
06/24/08 04:36:36 (16 years ago)
Author:
ppalmers
Message:

fix up lock checking

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libffado-2.0/src/libutil/PosixMutex.cpp

    r1206 r1267  
    138138{ 
    139139    debugOutput(DEBUG_LEVEL_ULTRA_VERBOSE, "(%p) checking lock\n", this); 
    140     int res=pthread_mutex_trylock(&m_mutex); 
     140    int res = pthread_mutex_trylock(&m_mutex); 
    141141    if(res == 0) { 
    142142        pthread_mutex_unlock(&m_mutex); 
    143143        return false; 
    144144    } else { 
    145         if(res != EBUSY) { 
     145        if (res == EDEADLK) { 
     146            // this means that the current thread already has the lock, 
     147            // iow it's locked. 
     148            debugOutput(DEBUG_LEVEL_ULTRA_VERBOSE, "(%p) lock taken by current thread\n", this); 
     149        } else if(res == EBUSY) { 
     150            debugOutput(DEBUG_LEVEL_ULTRA_VERBOSE, "(%p) lock taken\n", this); 
     151        } else { 
    146152            debugError("Bogus error code: %d\n", res); 
    147153        }