Added session locking support

Hi.. I added session locking support. I hope you like it.