Separate internal lock from user's lock

- Now different type of lock can be used for protecting the accesses
the global structures in partial lock.

- Added one more test for the use case of 'readers-writer lock'.