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.
Mutex: Release all held mutexes when a thread exits.
Mutex: Remove some forward declarations

Moved Mutex::WaitSynchronization to the end of the file.
Merge pull request #256 from Subv/mutex

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