[threading] Implement 'pulse' transition for two-phase STW (#11708)
* [threading] Add `pulse` transition and begin_pulse_resume_and_request_suspension operation.
A `pulse` atomically resumes a preemptively suspended GC Safe thread and
requests that it suspend again.
If the thread reaches a GC Safe -> GC Unsafe transition, it will self-suspend.
If it doesn't, another iteration of the 'mop up' STW phase will async suspend
it again.
* [threading] Use pulse_resume_and_request_suspension in STW
With non-hybrid suspend, a pulse is just a resume.
With hybrid suspend, a `pulse` is a combination of a resume of a preemptively
suspended GC Unsafe thread and a request that it suspend again - as if we
atomically resumed the thread and then applied the initial phase of two-phase
suspend again. If the now-running thread comes to a GC Safe -> GC Unsafe
transition it will suspend. If not, we will preemptively suspend it again
during the mop-up phase.
The important thing is that we don't want the thread to transition to GC Unsafe
again: if it does so, it may try to take a lock that some other
async-suspended thread is holding, and it will never reach a safepoint ---
exactly the situation that two-phase suspend is supposed to solve.
* [threads] Add mono_threads_is_multiphase_stw_enabled
Flip the logic in mono_thread_info_begin_pulse_resume_and_request_suspension