Updated to checkt HAVE_ERRORCHECK_MUTEX
Handle older versions of pthreads without mutexattrs