Add locking mechanism for kTBS Root
Refactor locking mechanism

This puts the locking mechanism at the KtbsResource level.
One must override the _get_semaphore_name() method in order for the lock() method to succeed.