genirq: Fix race condition when stopping the irq thread