core: races and missing restoreIRQ in mutex_unlock

`mutex_unlock()` did not restore IRQsbefore yielding for the woken up
thread.

The priority of the woken up thread has to be read before reenabling the
IRQs, or there will a race condition.