mutex PTHREAD_MUTEX_ERRORCHECK and pthread_cancel issues