Implement basic lock functionality. Doesn't pass test (probably because join is broken)