Added ObjectLock template class to add mutex lock option to any object.