and to lock the thread.