add mutex_unlock_and_sleep()

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