add the thread lock