Wrap all calls to pthread_mutex_lock() and pthread_mutex_unlock() within CtdlLogResult()