Thread safety

this needs to be synchronized to protect internal state (paused)