core: thread: use disableIRQ/restoreIRQ

Maybe store the result of isISR()?