//The mutex was created with the protocol attribute having the value PTHREAD_PRIO_PROTECT and the calling thread's priority is higher than the mutex's current priority ceiling.
returnWRONG_ATTRIBUTE_SETTING;
//The process or thread would have blocked, and the abs_timeout parameter specified a nanoseconds field value less than zero or greater than or equal to 1000 million.
//The value specified by mutex does not refer to an initialized mutex object.
//return MUTEX_NOT_FOUND;
caseEBUSY:
//The mutex could not be acquired because it was already locked.
returnMUTEX_ALREADY_LOCKED;
caseETIMEDOUT:
//The mutex could not be locked before the specified timeout expired.
returnMUTEX_TIMEOUT;
caseEAGAIN:
//The mutex could not be acquired because the maximum number of recursive locks for mutex has been exceeded.
returnMUTEX_MAX_LOCKS;
caseEDEADLK:
//A deadlock condition was detected or the current thread already owns the mutex.
returnCURR_THREAD_ALREADY_OWNS_MUTEX;
case0:
//Success
returnHasReturnvaluesIF::RETURN_OK;
default:
returnHasReturnvaluesIF::RETURN_FAILED;
};
}
ReturnValue_tMutex::unlockMutex(){
intstatus=pthread_mutex_unlock(&mutex);
switch(status){
caseEINVAL:
//The value specified by mutex does not refer to an initialized mutex object.
returnMUTEX_NOT_FOUND;
caseEAGAIN:
//The mutex could not be acquired because the maximum number of recursive locks for mutex has been exceeded.