Kernel/Mutex: Properly lock the mutex when a thread enters it

Also resume only the next immediate thread waiting for the mutex when it is released, instead of resuming them all.
I'm pretty sure these are supposed to be in the header?