core: thread: use disableIRQ/restoreIRQ