Thread protection for running state and queue