Idea Detail view

 
 
 

Add support for pthread_mutex_trylock() semantics

 

As described in http://www.gimpel.com/Discussion.cfm?ThreadID=3793 this functionality is needed.

For example, this function results in lint warning 455 (A thread mutex that had not been locked is being unlocked):

 

   bool IsLocked()
   {
       int retStat = pthread_mutex_trylock(&m_pthreadMutex);
       if (retStat == 0)
       {
           // Mutex was not locked, but is now.
           pthread_mutex_unlock(&m_pthreadMutex);
           return (false);
       }
       else if (retStat == EBUSY)
       {
           // Mutex is already locked.
           return (true);
       }
       return (false);
   }
 

 

 

Pending

17 Votes