thread lock example