Added pthread_lock wrapper