src/mutex.c
/**
 * Attempts to lock a mutex.
 *
 * @param mutex A mutex.
 * @return 0 if successful or 1 if an error occurred.
 */
Attempts to lock a mutex.
@param mutex A mutex.
@return 0 if successful or 1 if an error occurred.
Attempts to lock a mutex . @param mutex A mutex . @return 0 if successful or 1 if an error occurred .
int lockMutex(pthread_mutex_t *mutex) {
    if (NULL == mutex) {
	    printError(
		    0,
		    __FILE__,
		    __PRETTY_FUNCTION__,
		    "Could not lock mutex as it is null."
	    );
        return 1;
    }
    if (0 != (errno = pthread_mutex_lock(mutex))) {
	    printError(
		    errno,
		    __FILE__,
		    __PRETTY_FUNCTION__,
		    "Could not lock mutex."
	    );
        return 1;
    }
    return 0;
}
int lockMutex ( pthread_mutex_t * mutex ) { if ( NULL == mutex ) { printError ( 0 , __FILE__ , __PRETTY_FUNCTION__ , " " ) ; return 1 ; } if ( 0 != ( errno = pthread_mutex_lock ( mutex ) ) ) { printError ( errno , __FILE__ , __PRETTY_FUNCTION__ , " " ) ; return 1 ; } return 0 ; }
Attempts to lock a mutex.
Attempts to lock a mutex .