add basic structure for locking resources

Pull request for locking support, see #15