Lock autorefreshing

Implemented lock autorefreshing using the threading library. We use a
separate thread for every lock.