core:mutex: enable atomic execution of unlock a mutex and sleep for a thread

add function to release a mutex and send the current thread to sleep atomically