Add thread interupt handling