Implementing thread lock
Adding locked indicator