Use RAII for preventing user-code suspensions

In some places we want to prevent a thread from being suspended by a
kForUserCode suspension. Doing this requires gaining a lock,
checking our current suspension state and possibly retrying. To
simplify this we added a new RAII ScopedNoUserCodeSuspension
capability that does the needed checks.

Test: ./test.py --host
Change-Id: I48c08bc8f99b3574d241e7bfc6945b3358b6d082
4 files changed