Added self attribute to lock() and unlock()
Merge pull request #299 from Saphir/master

Added self argument to lock and unlock.