Rewriten with SimpleLock class