added per-thread lock wait timeout

#1168