optimize locking

http://msdn.microsoft.com/en-us/library/c5kehkcz.aspx
add a description