Added a mutex test, and fixed a small bug in irq handling