Enable to pause the repository (#215)

@calmh 
I implement pause in the way that you described in #215.
Some feedback will be valuable.
Why do you need the 2nd check which should never be checked?
I guess its some sort of protection against a race condition?